activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xabhi <xabh...@gmail.com>
Subject ActiveMQ Object Message to json transformation not working
Date Wed, 16 Mar 2016 05:38:54 GMT
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.

Mime
View raw message