jms-json transformation: missing library

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

jms-json transformation: missing library

mjustin
Dear all,

with the current 5.1 snapshot, jms-json transformation requires the Thoughtworks xstream library which is not included in the binary distribution.

I have found a download location for the required jars: http://dist.codehaus.org/com.thoughtworks.xstream/jars/


If the jar can not be included for license reasons, maybe this info could be added to the relevant pages (for example on http://activemq.apache.org/stomp.html)

Best Regards
Michael Justin
Michael Justin
habarisoft - Enterprise Messaging Software for Delphi™
http://www.habarisoft.com/
Reply | Threaded
Open this post in threaded view
|

Re: jms-json transformation: missing library

dejanb
Hi Michael,

you are right, XStream is an optional dependency, so you have to put
it manually into the lib/ folder. Additionally, you have to include
jettison (http://jettison.codehaus.org) into broker's classpath if you
plan to use JSON. I've just updated docs with this info
(http://cwiki.apache.org/confluence/display/ACTIVEMQ/Stomp).

Thanks
--
Dejan Bosanac
www.scriptinginjava.net

On Mon, Mar 24, 2008 at 10:27 AM, mjustin <[hidden email]> wrote:

>
>  Dear all,
>
>  with the current 5.1 snapshot, jms-json transformation requires the
>  Thoughtworks xstream library which is not included in the binary
>  distribution.
>
>  I have found a download location for the required jars:
>  http://dist.codehaus.org/com.thoughtworks.xstream/jars/
>
>
>  If the jar can not be included for license reasons, maybe this info could be
>  added to the relevant pages (for example on
>  http://activemq.apache.org/stomp.html)
>
>  Best Regards
>  Michael Justin
>
>  --
>  View this message in context: http://www.nabble.com/jms-json-transformation%3A-missing-library-tp16247478s2354p16247478.html
>  Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: jms-json transformation: missing library

mjustin
Hello Dejan,

many thanks - it works like a charm now.

Now I am stuck just at the next corner and could have know before:

I wrote a SamplePojo class and send it from a Java producer tool, and it successfully shows up in the web admin console. It appears in the typical Java notation in the 'Message Details' field: SamplePojo@e3f6d.

Then I tried to send a JSON encoded object from Delphi which has the 'transformation' property set to 'jms-json'. The message appears but no object is shown in the message view.

This is no surprise because JSON does not know anything about classes, it is just a data exchange format.

Now the question: is it possible to send a JSON encoded object to ActiveMQ so that it will be mapped to the SamplePojo class (given that the JSON object contains values for the the pojo properties)?

Or should I better use jms-xml and SOAP serialization for mixed programming languages?

Best Regards

Michael Justin




Dejan Bosanac wrote
Hi Michael,

you are right, XStream is an optional dependency, so you have to put
it manually into the lib/ folder. Additionally, you have to include
jettison (http://jettison.codehaus.org) into broker's classpath if you
plan to use JSON. I've just updated docs with this info
(http://cwiki.apache.org/confluence/display/ACTIVEMQ/Stomp).
Michael Justin
habarisoft - Enterprise Messaging Software for Delphi™
http://www.habarisoft.com/
Reply | Threaded
Open this post in threaded view
|

Re: jms-json transformation: missing library

mjustin
Hi Dejan,

meanwhile I found out how a JSON-encoded java  object encodes the class name.
Now I can see that I can generate JSON-encoded objects with Java and Delphi, the differences are very small. Only the order of the fields changes:

Generated by the Java producer:
{"SamplePojo":{"name":"myname ...","id":"myId ..."}}

Generated by Delphi:
{"SamplePojo":{"id":"myid ...","name":"myname ..."}}

The Delphi-generated version does not show up as SamplePojo object in the admin console. This means that Java clients could not receive the objects which have been JSON-encoded by Delphi ...
I will investigate more and see if I can find something. (UTF8 encoding and decoding is enabled and checked).

Best Regards
Michael Justin


mjustin wrote
Then I tried to send a JSON encoded object from Delphi which has the 'transformation' property set to 'jms-json'. The message appears but no object is shown in the message view.

This is no surprise because JSON does not know anything about classes, it is just a data exchange format.

Now the question: is it possible to send a JSON encoded object to ActiveMQ so that it will be mapped to the SamplePojo class (given that the JSON object contains values for the the pojo properties)?
Michael Justin
habarisoft - Enterprise Messaging Software for Delphi™
http://www.habarisoft.com/
Reply | Threaded
Open this post in threaded view
|

Re: jms-json transformation: missing library

mjustin
Found it :)

The message was sent as a JMS BytesMessage (instead of a TextMessage) and the object property names have to be in lowercase. I am more than happy now

Kind Regards
Michael Justin

mjustin wrote
The Delphi-generated version does not show up as SamplePojo object in the admin console. This means that Java clients could not receive the objects which have been JSON-encoded by Delphi ...
Michael Justin
habarisoft - Enterprise Messaging Software for Delphi™
http://www.habarisoft.com/