You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by xbhanu <xb...@gmail.com> on 2013/11/29 08:01:00 UTC

Problems in publishing from AMQP-JMS Bridge

Hi,

I am publishing simple Object messages from the JMS-AMQP
bridge(qpid-amqp-1-0-client-jms-0.22.jar) to a Python AMQP client (the SWIG
proton wrapper from Qpid). The problem is that serializing/deserializing is
not happening properly.

Basically I am sending a Date() object in a JMSObjectMessage and getting the
output as
"\xac\xed\x00\x05sr\x00\x0ejava.util.Datehj\x81\x01KYt\x19\x03\x00\x00xpw\x08\x00\x00\x01B\xa2\x9fRax"
in AMQP java receiver and
"\ufffd\ufffdsrjava.util.Datehj\ufffdKYtxpB\ufffd\ufffd\ufffd!x" in AMQP
python reciever.
I get a nice output with JMS receiver though.


If I use the Java Messenger API to send the Date() Object in an AMQPValue
then AMQP clients can serialize and deserialize properly.

Do I need to set some extra headers when sending from JMS/AMQP bridge? or
what is it that needs to be done ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problems-in-publishing-from-AMQP-JMS-Bridge-tp4674936.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problems in publishing from AMQP-JMS Bridge

Posted by Gordon Sim <gs...@redhat.com>.
On 12/03/2013 05:41 AM, xbhanu wrote:
> Yes, But my point is that a similar AMQP message(a j.u.Date instance) sent by
> a java client written with the Messenger API (proton-j) are successfully
> interpreted by the AMQP Python/Perl client. Even sending a list or map from
> proton-j java client works so why does it not work from the
> qpid-amqp-1-0-client-jms client bridge?

If you send a MapMessage via the qpid-amqp-1-0-client-jms, I believe it 
will work even when receiver is a python program. The issue is with 
ObjectMessage. There isn't a direct equivalent to that in the 
MessengerAPI as it is a JMS construct and is defined to contain a 
serialized java object.

Now, it could certainly be argued that qpid-amqp-1-0-client-jms should 
do something less java specific for an ObjectMessage as well, which is 
perhaps your point. The difficulty is that ObjectMessage could contain 
any arbitrary java object (as long as it is serializable). Therefore it 
is not entirely trivial to map that to the AMQP typesystem.

For a Date object it could simply write in a single timestamp value. 
However for a more general, (e.g. perhaps application defined) object, 
it would need to recursively convert all serialized fields as well as 
possibly annotating any objects other than the primitives with their 
java type name (though this would not be that useful to receivers not 
written in java).

By all means raise a JIRA or ask this question on the qpid users list 
(users@qpid/apache.org). I do agree that it is something that is worth 
some discussion and at least a clearer statement of what to avoid in 
cross-language systems.


Re: Problems in publishing from AMQP-JMS Bridge

Posted by xbhanu <xb...@gmail.com>.
Yes, But my point is that a similar AMQP message(a j.u.Date instance) sent by
a java client written with the Messenger API (proton-j) are successfully
interpreted by the AMQP Python/Perl client. Even sending a list or map from
proton-j java client works so why does it not work from the
qpid-amqp-1-0-client-jms client bridge? 

Thanks,
Bhanu



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problems-in-publishing-from-AMQP-JMS-Bridge-tp4674936p4675011.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problems in publishing from AMQP-JMS Bridge

Posted by Gordon Sim <gs...@redhat.com>.
On 11/29/2013 07:01 AM, xbhanu wrote:
> Hi,
>
> I am publishing simple Object messages from the JMS-AMQP
> bridge(qpid-amqp-1-0-client-jms-0.22.jar) to a Python AMQP client (the SWIG
> proton wrapper from Qpid). The problem is that serializing/deserializing is
> not happening properly.
>
> Basically I am sending a Date() object in a JMSObjectMessage and getting the
> output as
> "\xac\xed\x00\x05sr\x00\x0ejava.util.Datehj\x81\x01KYt\x19\x03\x00\x00xpw\x08\x00\x00\x01B\xa2\x9fRax"
> in AMQP java receiver and
> "\ufffd\ufffdsrjava.util.Datehj\ufffdKYtxpB\ufffd\ufffd\ufffd!x" in AMQP
> python reciever.
> I get a nice output with JMS receiver though.
>
>
> If I use the Java Messenger API to send the Date() Object in an AMQPValue
> then AMQP clients can serialize and deserialize properly.
>
> Do I need to set some extra headers when sending from JMS/AMQP bridge? or
> what is it that needs to be done ?

It looks to me like the qpid-amqp-1-0-client-jms client is serializing 
the java object (in this case a java.util.Date instance) and sending 
that as a binary section in the AMQP 1.0 message.

That won't work if the recipient is not also in java (or at least on a 
jvm). I would suggest you change that to using e.g. a MapMessage or some 
explicit encoding of your own choosing that you know the python based 
application can handle.


Re: Problems in publishing from AMQP-JMS Bridge

Posted by xbhanu <xb...@gmail.com>.
Ping!! Help folks?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problems-in-publishing-from-AMQP-JMS-Bridge-tp4674936p4674979.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.