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 09:14:08 GMT
Hi All,

I found one more strange behaviour between Java and C++ when using AMQP 1.0:

When a java application sets properties they are invisible for the c++ 
client:

*** java sender sends a text message with a property:

MessageProducer messageProducer = producersession.createProducer(topic);
TextMessage message = producersession.createTextMessage("Hello world!");
message.setJMSType("Hello");
message.setStringProperty("testproperty","ttt");     // invisible for 
C++ Client
messageProducer.send(message);


*** The java receiver prints:

Received text Message:
======================
Hello world!
testproperty: ttt


*** The c++ receiver prints:

2014-07-21 10:45:54.55301 [12359.140273439021248] INFO qpid msg - AMQP 
MESSAGE ==============================================================
2014-07-21 10:45:54.55305 [12359.140273439021248] INFO qpid msg - AMQP 
Header:
2014-07-21 10:45:54.55307 [12359.140273439021248] INFO qpid msg - 
Subject..........:
2014-07-21 10:45:54.55308 [12359.140273439021248] INFO qpid msg - 
content type.....:
2014-07-21 10:45:54.55325 [12359.140273439021248] INFO qpid msg - 
content size.....: 12
2014-07-21 10:45:54.55326 [12359.140273439021248] INFO qpid msg - 
message id.......: 2714741a-540f-4d88-997f-39d720621540
2014-07-21 10:45:54.55328 [12359.140273439021248] INFO qpid msg - user 
id..........:
2014-07-21 10:45:54.55329 [12359.140273439021248] INFO qpid msg - 
correlation id...:
2014-07-21 10:45:54.55331 [12359.140273439021248] INFO qpid msg - 
priority.........: 4
2014-07-21 10:45:54.55332 [12359.140273439021248] INFO qpid msg - time 
to live (ms): 0
2014-07-21 10:45:54.55333 [12359.140273439021248] INFO qpid msg - 
durable..........: yes
2014-07-21 10:45:54.55334 [12359.140273439021248] INFO qpid msg - 
redelivered......: 0
2014-07-21 10:45:54.55335 [12359.140273439021248] INFO qpid msg - reply 
to.........:
2014-07-21 10:45:54.55336 [12359.140273439021248] INFO qpid msg - Custom 
Properties:
2014-07-21 10:45:54.55339 [12359.140273439021248] INFO qpid msg - 
qpid.msg_sequence..: 10
2014-07-21 10:45:54.55340 [12359.140273439021248] INFO qpid msg - 
x-opt-jms-type..: Hello            <==== OK, the JMS Type can be read as 
a property
2014-07-21 10:45:54.55341 [12359.140273439021248] INFO qpid msg - 
x-opt-to-type..: topic
2014-07-21 10:45:54.55342 [12359.140273439021248] INFO qpid msg - Content:
2014-07-21 10:45:54.55343 [12359.140273439021248] INFO qpid msg - Hello 
world!                               <==== OK, the text content can be read
2014-07-21 10:45:54.55344 [12359.140273439021248] INFO qpid msg - End 
AMQP MESSAGE ==========================================================

The property "testproperty" is not visible using this code:

typedef qpid::types::Variant::Map::const_iterator QpidMapCIt;
void getProperties(const qpid::messaging::Message &msg, FieldVec &fields)
{
     qpid::types::Variant::Map properties = msg.getProperties();
     for (QpidMapCIt it = properties.begin(); it != properties.end(); ++it)
     {
         fields.push_back(MsgField(it->first, it->second.asString()));
     }
}

Do you think this is a bug in QPID or is there something wrong with my code?


Regards,
Andreas




Am 18.07.2014 15:25, schrieb Andreas Welchlin:
> 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.
>
> Here is the logfile from the API:
> -------------------------------------------------------------------------------------------------------

>
> In ConnectionContext::get(), current=0x7fa0e00036a0
> Received message of 241 bytes:
> Recorded delivery 0 -> 0x7fa0e00036a0
> wakeupDriver()
> acknowledging all 1 messages
> Setting disposition for delivery 0 -> 0x7fa0e00036a0
> wakeupDriver()
> tcp:127.0.0.1:5672 encoded 39 bytes from 65535
> Exception constructed: Not enough data for field table. 
> (/home/noname/install/qpid-0.28/qpid-0.28/cpp/src/qpid/framing/FieldTable.cpp:302)
> wakeupDriver()
> tcp:127.0.0.1:5672 encoded 42 bytes from 65535
> tcp:127.0.0.1:5672 decoded 42 bytes from 42
> [127.0.0.1:48347-127.0.0.1:5672] TcpTransport closing...
> [127.0.0.1:48347-127.0.0.1:5672] Socket closed
> Driver stopped
> -------------------------------------------------------------------------------------------------------

>
>
> Does anyone have an idea what is wrong, here?
>
> Andreas
>
>


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


Mime
View raw message