You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Daniel Wenske <da...@gmail.com> on 2015/01/22 17:32:08 UTC

Can not read Properties using qpid 0.28 from ActiveMq Message Broker

Hi everyone,

I am using the qpid 0.28 messaging api.

There is a problem when I try to read properties of amqp 1.0 messages from
an ActiveMq message broker.

It is possible to read the fields like userId and I can also read the
content. But when I read the properties with the following code I do not
get them:

------------------------------------------------

const qpid::types::Variant::Map& map = mMessage.getProperties();

std::cout << "Property map size: " << map.size() << std::endl;

for (qpid::types::Variant::Map::const_iterator it = map.begin(); it !=
map.end(); ++it) {

     std::cout << "- Key: " << it->first << " Value: " << it->second.
asString() << std::endl;

}

------------------------------------------------

 The output is just this:

------------------------------------------------

Property map size: 1

- Key: x-opt-to-type Value: topic

------------------------------------------------

 I switched on the qpid library logging and can see the properties are
there. It shows the following:

 ------------------------------------------------

[b9cbdccd-8dec-46e6-a777-4d47e5d80c5a]: 0 <- @transfer(20) [handle=2,
delivery-id=36, delivery-tag=b"3", message-format=0] (1824705)
"\x00Sp\xc0\x04\x02AP\x04\x00Sr\xc1\x17\x02\xa1\x0dx-opt-to-type\xa1\x05topic\x00Ss\xc0m\x0a\xa1;ID:er0jb01.
ttt.aaa-56349-1421830015225-3:12667:22:2:202@\xa1\x1dtopic://USERA.
MasterDataTopic
@@@@@@\x83\x00\x00\x01K\x12PS\x86\x00St\xc18\x02\xa1\x15uniqueMessageTypeCode\xa1\x1eRD_SNAPSHOT_ALT_INSTRUMENT_IDS\x00Sw\xb1\x00\x1b\xd6\xe5<?
xml version="1.0" encoding="UTF-8" standalone="yes"?>... (truncated, msg
content follows...)

 ------------------------------------------------

I am expecting a field called uniqueMessageTypeCode (which I see in the
dump above) containing a string value RD_SNAPSHOT_ALT_INSTRUMENT_IDS -
which also seems to be in place. x-opt-to-type (with value "topic") is also
contained, but I manage to extract only this one, not the one I am actually
interested in.

Any help is greatly appreciated & thanks in advance

Daniel

Re: Can not read Properties using qpid 0.28 from ActiveMq Message Broker

Posted by Daniel Wenske <da...@gmail.com>.
Hi Gordon,

thanks a million, just tried it out and it worked like a charm!

Cheers,

Daniel



2015-01-22 18:31 GMT+01:00 Gordon Sim <gs...@redhat.com>:

> On 01/22/2015 04:32 PM, Daniel Wenske wrote:
>
>>   I switched on the qpid library logging and can see the properties are
>> there. It shows the following:
>>
>>   ------------------------------------------------
>>
>> [b9cbdccd-8dec-46e6-a777-4d47e5d80c5a]: 0 <- @transfer(20) [handle=2,
>> delivery-id=36, delivery-tag=b"3", message-format=0] (1824705)
>> "\x00Sp\xc0\x04\x02AP\x04\x00Sr\xc1\x17\x02\xa1\x0dx-
>> opt-to-type\xa1\x05topic\x00Ss\xc0m\x0a\xa1;ID:er0jb01.
>> ttt.aaa-56349-1421830015225-3:12667:22:2:202@\xa1\x1dtopic://USERA.
>> MasterDataTopic
>> @@@@@@\x83\x00\x00\x01K\x12PS\x86\x00St\xc18\x02\xa1\
>> x15uniqueMessageTypeCode\xa1\x1eRD_SNAPSHOT_ALT_INSTRUMENT_
>> IDS\x00Sw\xb1\x00\x1b\xd6\xe5<?
>> xml version="1.0" encoding="UTF-8" standalone="yes"?>... (truncated, msg
>> content follows...)
>>
>>   ------------------------------------------------
>>
>> I am expecting a field called uniqueMessageTypeCode (which I see in the
>> dump above) containing a string value RD_SNAPSHOT_ALT_INSTRUMENT_IDS -
>> which also seems to be in place. x-opt-to-type (with value "topic") is
>> also
>> contained, but I manage to extract only this one, not the one I am
>> actually
>> interested in.
>>
>> Any help is greatly appreciated & thanks in advance
>>
>
> This looks like https://issues.apache.org/jira/browse/QPID-5908. The
> x-opt-type is an annotation, and as per the bug description, on decoding
> it, the library is erroneously replacing the properties map with the
> annotations map.
>
> The issue is fixed in 0.30, but you can also set a connection option
> 'nest_annotations' to true as a workaround. That way you will get the
> x-opt-type annotation within a nested map keyed
> 'x-amqp-message-annotations', along side the property.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Can not read Properties using qpid 0.28 from ActiveMq Message Broker

Posted by Gordon Sim <gs...@redhat.com>.
On 01/22/2015 04:32 PM, Daniel Wenske wrote:
>   I switched on the qpid library logging and can see the properties are
> there. It shows the following:
>
>   ------------------------------------------------
>
> [b9cbdccd-8dec-46e6-a777-4d47e5d80c5a]: 0 <- @transfer(20) [handle=2,
> delivery-id=36, delivery-tag=b"3", message-format=0] (1824705)
> "\x00Sp\xc0\x04\x02AP\x04\x00Sr\xc1\x17\x02\xa1\x0dx-opt-to-type\xa1\x05topic\x00Ss\xc0m\x0a\xa1;ID:er0jb01.
> ttt.aaa-56349-1421830015225-3:12667:22:2:202@\xa1\x1dtopic://USERA.
> MasterDataTopic
> @@@@@@\x83\x00\x00\x01K\x12PS\x86\x00St\xc18\x02\xa1\x15uniqueMessageTypeCode\xa1\x1eRD_SNAPSHOT_ALT_INSTRUMENT_IDS\x00Sw\xb1\x00\x1b\xd6\xe5<?
> xml version="1.0" encoding="UTF-8" standalone="yes"?>... (truncated, msg
> content follows...)
>
>   ------------------------------------------------
>
> I am expecting a field called uniqueMessageTypeCode (which I see in the
> dump above) containing a string value RD_SNAPSHOT_ALT_INSTRUMENT_IDS -
> which also seems to be in place. x-opt-to-type (with value "topic") is also
> contained, but I manage to extract only this one, not the one I am actually
> interested in.
>
> Any help is greatly appreciated & thanks in advance

This looks like https://issues.apache.org/jira/browse/QPID-5908. The 
x-opt-type is an annotation, and as per the bug description, on decoding 
it, the library is erroneously replacing the properties map with the 
annotations map.

The issue is fixed in 0.30, but you can also set a connection option 
'nest_annotations' to true as a workaround. That way you will get the 
x-opt-type annotation within a nested map keyed 
'x-amqp-message-annotations', along side the property.



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