You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Suneel Papineni <Su...@mettoni.com> on 2011/05/03 19:10:59 UTC
Advisory Messages - isConnectionInfo() and isRemoveInfo() methods
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.
Note: I tried this with ActiveMQ-CPP 3.4.0.
Thanks & Regards
Suneel
RE: Advisory Messages - isConnectionInfo() and isRemoveInfo() methods
Posted by Suneel Papineni <Su...@mettoni.com>.
Thanks Tim. It works on Command instance.
-----Original Message-----
From: Timothy Bish [mailto:tabish121@gmail.com]
Sent: 03 May 2011 18:43
To: users@activemq.apache.org
Subject: Re: Advisory Messages - isConnectionInfo() and isRemoveInfo() methods
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.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/
Connect at CamelOne May 24-26
The Open Source Integration Conference
Re: Advisory Messages - isConnectionInfo() and isRemoveInfo()
methods
Posted by Timothy Bish <ta...@gmail.com>.
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.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/
Connect at CamelOne May 24-26
The Open Source Integration Conference