activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ironrooster <>
Subject how to get topicName from within onMessage()
Date Fri, 15 Jan 2010 00:43:46 GMT

Hi all,
    I am an ActiveMQ newbie who has managed to get a consumer/producer
system working using topics.  I would like to know which topic has sent a
particular message, but I can't figure out how to do it.  Perhaps someone
will have mercy on this problem and shoot it, like an injured horse.


p.s. here is a code sample, with a lot removed for simplicity.  The
if...else is what matters to me.

virtual void onMessage( const Message* message ){

 <do some stuff here>

  const TextMessage* textMessage =
                dynamic_cast< const TextMessage* >( message );

  string text = textMessage->getText();

  if( message->propertyExists( "topicName" ))
	text.append( message->getStringProperty("topicName") );

  <do some more stuff here>

After execution, "text" always contains "*nope!*"
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message