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 12:12:47 GMT

Am 21.07.2014 13:52, schrieb Gordon Sim:
> On 07/21/2014 12:28 PM, Andreas Welchlin wrote:
>> No, I am not using getContentObject but the decode function:
>
> Ok, that is the problem. You need to use getContentObject() for AMQP 
> 1.0 messages. You can use that for 0-10 also and it works regardless 
> of the type of object sent (e.g. binary or utf will also be correctly 
> retrieved).
>
> The qpid::messaging::decode() functions only decode 0-10 typed data. 
> In AMQP 1.0, rather than using a content-type header to indicate the 
> type of the content, the AMQP type system itself is used. This meant 
> we had to add something to the API to expose that information. The 
> concept of content object was added which indicates the type through 
> Variant::getType() but also presents a decoded representation.
......
> The above would be something like:
>
> using namespace qpid::types;
>
> MyMessage::MyMessage(const qpid::messaging::Message &qpidMessage)
> {
>     if (qpidMessage.getContentObject().getType() != VAR_MAP)
>     {
>         THROW(UsrException, "Message content was not a map!");
>     }
>     Variant::Map map = qpidMessage.getContentObject().asMap();
>     mSystemMessageId.assign(map["SytemMsgId"].asString());
>     mContent = map["content"].asString();
> }

Oh, I missed this when I was moving to AMQP 1.0.

Funny that it seemed to work with "decode()" as long as I only used C++ 
applications. I think the reason was that the C++ senders used also 
"encode()".

Now I used your code and everything works perfectly, now. (I also 
changed the C++ senders to use "setContentObject()".

Thank you very much for your help, Gordon!

Andreas




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


Mime
View raw message