On Tue, 2011-05-03 at 18:10 +0100, Suneel Papineni wrote:
> Hi,
> 
>  
> 
> I am trying to see if "isConnectionInfo() and isRemoveInfo()" methods
> are working fine. Created a consumer with a destination
> "ActiveMQ.Advisory.Connection" and implemented following code in
> onMessage() method.
> 
> ##############################
> 
> virtual void onMessage( const cms::Message* message ) throw() {
> 
> if(message->getCMSType() == "Advisory")
> 
> {
> 
> const ActiveMQMessage* amqMessage = dynamic_cast< const ActiveMQMessage*
> >( message );
> 
>       if(amqMessage != NULL && amqMessage->getDataStructure() != NULL)
> 
>       {
> 
>             std::cout << "Connection Info : " <<
> amqMessage->isConnectionInfo() <<std::endl; 
> 
>             std::cout << "Remove Info : " << amqMessage->isRemoveInfo()
> <<std::endl; 
> 
>             std::cout << "Data Structure  -- " <<
> amqMessage->getDataStructure()->toString() <<std::endl; 
> 
>        }
> 
> }
> 
> }           
> 
> ######################
> 
>  
> 
> Here both isConnectionInfo() and isRemoveInfo() methods are returning as
> "0" irrespective of messages received (even for Connection or Remove
> messages). Data Structure is displayed properly as "ConnectionInfo" or
> "RemoveInfo".
> 
>  
> 
> Could you please let me know if there is any change required in my
> implementation to get correct values for these methods.
> 
>  

You are calling those methods on the Message object itself, so yes, they
will always return false.  You need to cast the DataStructure to a
Command instance and if that succeeds then you can call them on that.

Regards


-- 
Tim Bish
------------
FuseSource
Email: tim.b...@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/

Connect at CamelOne May 24-26

The Open Source Integration Conference

Reply via email to