qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Welchlin <andreas.welch...@comyno.com>
Subject Re: QPid 0.28 amqp1.0 - sending map from java to c++ does not work
Date Mon, 21 Jul 2014 11:37:50 GMT
Hi Gordon,

Cool!

I tried it and it works.

Thank you very much!

This workaround helps me very much.

Cheers
Andreas







Am 21.07.2014 13:28, schrieb Andreas Welchlin:
> Hi Gordon,
>
> thank you for your answer. I am also using the c++ broker (0.28).
>
> >How are you getting the content using qpid::messaging? Are you using 
> Message::getContentObject()?
>
> No, I am not using getContentObject but the decode function:
>
>
> MyMessage::MyMessage(const qpid::messaging::Message &qpidMessage)
> {
>     if (qpidMessage.getContentType() != "amqp/map")
>     {
>         // When Java Applications send an AMQP/MAP in amqp version 
> 1.0, then the string is found
>         // in the properties.
>         qpid::types::Variant::Map properties = 
> qpidMessage.getProperties();
>         if (properties["x-opt-jms-type"].asString() != "amqp/map")
>             THROW(UsrException, "wrong content type (!= amqp/map): " 
> << qpidMessage.getContentType());
>     }
>
>     qpid::types::Variant::Map map;
>     qpid::messaging::decode(qpidMessage, map);
>     mSystemMessageId.assign(map["SytemMsgId"].asString());
>     mContent = map["content"].asString();
> }
>
> Regards,
> Andreas
>
>
> Am 21.07.2014 13:20, schrieb Gordon Sim:
>> On 07/18/2014 02:25 PM, Andreas Welchlin wrote:
>>> Hi List,
>>>
>>> I used Hello.java from "qpid-java-amqp-1-0-client-jms-0.28.tar.gz" to
>>> send an amqp 1.0 message which contains a map to an exchange.
>>>
>>> Java Code:
>>> -------------------------------------------------------------------------------------------------------

>>>
>>>
>>>        MapMessage mapmessage = producersession.createMapMessage();
>>>        mapmessage.setStringProperty("hello","true");
>>>        mapmessage.setBoolean("mybool", true);
>>>        mapmessage.setString("mystring", "hello");
>>>        mapmessage.setLong("mylong", -25L);
>>>        messageProducer.send(mapmessage);
>>> -------------------------------------------------------------------------------------------------------

>>>
>>>
>>>
>>> This works when I read the message with the java application.
>>>
>>> But when I read it with a C++ client (linked qpid 0.28 library) then it
>>> can read the message and dump it as a text but it fails decoding the 
>>> map.
>>> The c++ client uses "{protocol:amqp1.0}" when the connection is 
>>> created.
>>> The c++ client is able to decode map messages from other c++ senders
>>> without any problems.
>>
>> It works for me when using the 0.28 version of both jms and c++ 
>> client libraries, and the c++ broker.
>>
>> How are you getting the content using qpid::messaging? Are you using 
>> Message::getContentObject()?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>>
>

-- 
Comyno Ltd.
Mainzer Landstrasse 46
60325 Frankfurt

www.comyno.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message