You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Tom Johnson <tj...@microaut.com> on 2008/02/05 21:51:54 UTC
AMQ-CPP MapMessage
I was trying to use a map message from a C++ program. It appears to send a
message but none of the fields from the map. I tested this by modifying
the vs2005-activemq-example to send a MapMessage in the producer:
MapMessage *message=session->createMapMessage();
message->setInt("MsgNum",ix);
message->setString("Thread",threadIdStr.c_str());
and getting one in the consumer:
const MapMessage * mapMessage=
dynamic_cast<const MapMessage *>(message);
if (mapMessage!=NULL) {
int num=mapMessage->getInt("MsgNum");
printf("Msg #%d from
thread%s\n",num,mapMessage->getString("Thread").c_str());
} else {
printf("Not a map message\n");
}
Exception was thrown whenever the getInt was called.
I'm using Visual Studio 2005 to build it.
--
View this message in context: http://www.nabble.com/AMQ-CPP-MapMessage-tp15299238s2354p15299238.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: AMQ-CPP MapMessage
Posted by Tom Johnson <tj...@microaut.com>.
Done, although not sure it was done correctly. Key is AMQCPP-166
nmittler wrote:
>
> Sounds like a bug - mind opening a JIRA issue for this?
>
> Thanks,
> Nate
>
> On Feb 5, 2008, at 12:51 PM, Tom Johnson wrote:
>
>>
>> I was trying to use a map message from a C++ program. It appears
>> to send a
>> message but none of the fields from the map. I tested this by
>> modifying
>> the vs2005-activemq-example to send a MapMessage in the producer:
>>
>> MapMessage *message=session->createMapMessage();
>> message->setInt("MsgNum",ix);
>> message->setString("Thread",threadIdStr.c_str());
>>
>> and getting one in the consumer:
>> const MapMessage * mapMessage=
>> dynamic_cast<const MapMessage *>(message);
>> if (mapMessage!=NULL) {
>> int num=mapMessage->getInt("MsgNum");
>> printf("Msg #%d from
>> thread%s\n",num,mapMessage->getString("Thread").c_str());
>> } else {
>> printf("Not a map message\n");
>> }
>>
>> Exception was thrown whenever the getInt was called.
>>
>> I'm using Visual Studio 2005 to build it.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/AMQ-CPP-MapMessage-tp15299238s2354p15299238.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>
>
--
View this message in context: http://www.nabble.com/AMQ-CPP-MapMessage-tp15299238s2354p15306645.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: AMQ-CPP MapMessage
Posted by Nathan Mittler <na...@gmail.com>.
Sounds like a bug - mind opening a JIRA issue for this?
Thanks,
Nate
On Feb 5, 2008, at 12:51 PM, Tom Johnson wrote:
>
> I was trying to use a map message from a C++ program. It appears
> to send a
> message but none of the fields from the map. I tested this by
> modifying
> the vs2005-activemq-example to send a MapMessage in the producer:
>
> MapMessage *message=session->createMapMessage();
> message->setInt("MsgNum",ix);
> message->setString("Thread",threadIdStr.c_str());
>
> and getting one in the consumer:
> const MapMessage * mapMessage=
> dynamic_cast<const MapMessage *>(message);
> if (mapMessage!=NULL) {
> int num=mapMessage->getInt("MsgNum");
> printf("Msg #%d from
> thread%s\n",num,mapMessage->getString("Thread").c_str());
> } else {
> printf("Not a map message\n");
> }
>
> Exception was thrown whenever the getInt was called.
>
> I'm using Visual Studio 2005 to build it.
>
> --
> View this message in context: http://www.nabble.com/AMQ-CPP-MapMessage-tp15299238s2354p15299238.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>