You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mjustin <mi...@gmx.net> on 2009/01/29 14:39:09 UTC

Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Dear mailing list,

my STOMP client receives ObjectMessage STOMP frames with the
transformation=jms-json header set, but with an empty body.

In my test, a Java client sends object messages to the broker, specifying
jms-json transformation.

The JAR file for the SamplePojo class, jettison and xstream are in the lib
folder. 

The admin console shows the object message with "transformation jms-json" in
the property list, and "SamplePojo@6dd60e" in the message details.

The Java client can also successfully read the object message back from the
broker.

However, my STOMP client receives the message without any JSON content. In
my client, I have also included 'transformation=jms-json' to the SUBSCRIBE
frame as mentioned in http://activemq.apache.org/stomp.html

This is the received message content:

MESSAGE
redelivered:true
message-id:ID:acer-995304b6c9-1168-1233235401609-0:0:1:1:1
transformation:jms-json
destination:/queue/TOOL.OBJECT.JSON
timestamp:1233235401968
expires:0
subscription:{D055D632-E777-48FE-9B18-1729457390F0}
priority:4

I have tried with ActiveMQ 5.1 and 5.2 
And have no more ideas what could be wrong.

Best Regards
Michael Justin




-- 
View this message in context: http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21727046.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Posted by Dejan Bosanac <de...@nighttale.net>.
Great! I'm looking forward to it.

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Sun, Feb 1, 2009 at 2:39 PM, mjustin <mi...@gmx.net> wrote:

>
> Problem solved, spelled transformation id wrongly and did not pass the
> transformation request to the destination name ...
>
> The next release of the Delphi / Free Pascal client library is back on the
> road again =)
>
> Michael
>
> --
> View this message in context:
> http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21775291.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Posted by mjustin <mi...@gmx.net>.
Problem solved, spelled transformation id wrongly and did not pass the
transformation request to the destination name ...

The next release of the Delphi / Free Pascal client library is back on the
road again =)

Michael

-- 
View this message in context: http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21775291.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Posted by mjustin <mi...@gmx.net>.


Dejan Bosanac wrote:
> 
> I guess we should set transformation_error header in cases like this.
> Added
> to TODO :)
> 

This would be very helpful. Until now I had no success even with annotated
classes, the message still has an empty body. Sending and receiving within a
Java client works perfectly. I then tried to receive the message using the
new Java API for STOMP, but after successful login, the client does not
receive the CONNECTED frame (I tried with and without authentication to
verify that the basic connection works).


Objectmessage with transformation=jms-json and JSON content sent from my
Delphi STOMP client will be received by the same client again correctly with
the message in JSON format. So it looks like the broker does not need a
matching Java class always.

However, if the JSON content matches the structure of a Java class in the
classpath, I assume that the broker should display it as an Java object in
the admin console - even if the sender is no Java application - and it
should be possible to retrieve an object in the Java client.

So I will also  try to send the JSON encoded object from the Delphi to the
Java client. I can build the correct JSON encoded message body using XStream
and just set up the Delphi side to send exactly this message content.

Best Regards
Michael Justin
-- 
"Hey! It compiles! Ship it!"




-- 
View this message in context: http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21762138.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Posted by Dejan Bosanac <de...@nighttale.net>.
I guess we should set transformation_error header in cases like this. Added
to TODO :)

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jan 29, 2009 at 3:14 PM, mjustin <mi...@gmx.net> wrote:

>
>
>
> Dejan Bosanac wrote:
> >
> > is your SamplePojo properly annotated so it can be marshaled with
> XStream?
> >
>
> Not yet - but I am sure this was the missing piece. The SamplePojo is just
> implementing Serializable, sorry that I have not checked the XStream
> documentation before - agile development is no excuse here ;)
>
> Best Regards
> Michael Justin
>
>
> --
> View this message in context:
> http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21727638.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Posted by mjustin <mi...@gmx.net>.


Dejan Bosanac wrote:
> 
> is your SamplePojo properly annotated so it can be marshaled with XStream?
> 

Not yet - but I am sure this was the missing piece. The SamplePojo is just
implementing Serializable, sorry that I have not checked the XStream
documentation before - agile development is no excuse here ;)

Best Regards
Michael Justin


-- 
View this message in context: http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21727638.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: XStream annotations for XML transformation

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Michael,

We can inject the configured xstream the transformer will use. For example,
for the SamplePojo used in tests we configure the xstream like this

  <bean class="org.apache.activemq.util.XStreamFactoryBean" name="xstream">
          <property
name="annotatedClass"><value>org.apache.activemq.transport.stomp.SamplePojo</value></property>
  </bean>

so it get properly annotated.

I see now that they added autodetectAnnotations(), so I'll experiment with
it a bit.

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Sat, Feb 14, 2009 at 9:46 AM, mjustin <mi...@gmx.net> wrote:

>
>
> Dejan Bosanac wrote:
> >
> >
> > is your SamplePojo properly annotated so it can be marshaled with
> XStream?
> >
> >
>
> In my tests (using ActiveMQ 5.2, XStream 1.3) I found that the
> serialization
> to XML works fine even without annotations, a simple (serializable) class
> can be received by a Stomp client in XML format, which is great because
> there are no dependencies in the class definition. My original problem was
> solved using correct transformation name.
>
> Now I tried to use annotations following the example on
> http://xstream.codehaus.org/annotations-tutorial.html. I can see the
> serialized 'RendezvousMessage' in the Admin console (as
> RendezvousMessage$NNNNN). And I can receive it in the Stomp client as XML,
> however, the annotations do not have an effect on the XML content.
>
> I have not yet checked in the ActiveMQ source if it calls the
> xstream.processAnnotations method for the object class, which seems to be
> necessary, or if I made a mistake somewhere else.
>
> --
> View this message in context:
> http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p22010420.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

XStream annotations for XML transformation

Posted by mjustin <mi...@gmx.net>.

Dejan Bosanac wrote:
> 
> 
> is your SamplePojo properly annotated so it can be marshaled with XStream?
> 
> 

In my tests (using ActiveMQ 5.2, XStream 1.3) I found that the serialization
to XML works fine even without annotations, a simple (serializable) class
can be received by a Stomp client in XML format, which is great because
there are no dependencies in the class definition. My original problem was
solved using correct transformation name.

Now I tried to use annotations following the example on
http://xstream.codehaus.org/annotations-tutorial.html. I can see the
serialized 'RendezvousMessage' in the Admin console (as
RendezvousMessage$NNNNN). And I can receive it in the Stomp client as XML,
however, the annotations do not have an effect on the XML content.

I have not yet checked in the ActiveMQ source if it calls the
xstream.processAnnotations method for the object class, which seems to be
necessary, or if I made a mistake somewhere else.

-- 
View this message in context: http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p22010420.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Broker sends empty body in STOMP ObjectMessage (using jms-json transformation)

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

is your SamplePojo properly annotated so it can be marshaled with XStream?

Regards
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jan 29, 2009 at 2:39 PM, mjustin <mi...@gmx.net> wrote:

>
> Dear mailing list,
>
> my STOMP client receives ObjectMessage STOMP frames with the
> transformation=jms-json header set, but with an empty body.
>
> In my test, a Java client sends object messages to the broker, specifying
> jms-json transformation.
>
> The JAR file for the SamplePojo class, jettison and xstream are in the lib
> folder.
>
> The admin console shows the object message with "transformation jms-json"
> in
> the property list, and "SamplePojo@6dd60e" in the message details.
>
> The Java client can also successfully read the object message back from the
> broker.
>
> However, my STOMP client receives the message without any JSON content. In
> my client, I have also included 'transformation=jms-json' to the SUBSCRIBE
> frame as mentioned in http://activemq.apache.org/stomp.html
>
> This is the received message content:
>
> MESSAGE
> redelivered:true
> message-id:ID:acer-995304b6c9-1168-1233235401609-0:0:1:1:1
> transformation:jms-json
> destination:/queue/TOOL.OBJECT.JSON
> timestamp:1233235401968
> expires:0
> subscription:{D055D632-E777-48FE-9B18-1729457390F0}
> priority:4
>
> I have tried with ActiveMQ 5.1 and 5.2
> And have no more ideas what could be wrong.
>
> Best Regards
> Michael Justin
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Broker-sends-empty-body-in-STOMP-ObjectMessage-%28using-jms-json-transformation%29-tp21727046p21727046.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>