On 03/16/2016 01:38 AM, xabhi wrote:
Hi,

I am having trouble sending a custom Object Message to a STOMP consumer with
ActiveMQ v5.11.1

In Jconsole, I can see messages being dequeued by STOMP consumer but the
subscription callback is never called.

However note that if I send a simple string as object message it gets
processed by STOMP consumer and I receive a JSON formatted message in this
format:
{"string":"hello"}

I create the message as follows:
myMessage = mySession.createObjectMessage("hello");
myProducers.get(destName).send(myMessage);

I am not sure what am i doing wrong here. Could anyone tell what is wrong
with this code?



Object Message class:
     public static class SampleObjectMessage implements Serializable
     {
         private static final long serialVersionUID = 1L;
         public String data;
         public long sendTimeMs;
         public SampleObjectMessage(String data, long sendTimeMs) {
             this.data = data;
             this.sendTimeMs = sendTimeMs;
         }
         public String getData() {
             return data;
         }
         public void setData(String data) {
             this.data = data;
         }
         public long getSendTimeMs() {
             return sendTimeMs;
         }
         public void setSendTimeMs(long sendTimeMs) {
             this.sendTimeMs = sendTimeMs;
         }
     }


Code for sending ObjectMessage:
myMessage = mySession.createObjectMessage(
                      new SampleObjectMessage(getMessageText(ourMessageSize),
                                              System.currentTimeMillis()));

myProducers.get(destName).send(myMessage);



STOMP consumer has following headers for subscription:

var subscriptionHeaders = {
   'ack'         : 'auto',
   'transformation' : 'jms-object-json'
};






--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMQ-Object-Message-to-json-transformation-not-working-tp4709447.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Is the class you are sending also available broker side to be deserialized? Did you check the broker logs to see if any information there clues you in to what is going on?

--
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply via email to