1
votes

Is there a way to put object in message in camel route process.

lets say i have a route

from("direct:send")
.process(queueProcessor)
.to(activemqEndPoint)

and in the queueProcessor i am putting an object in the exchange,

Now, I have a listener which listens to activemqEndPoint(queue)

public void onMessage(Message message) {
    try {
        //here i want to get the message i set it in the exchange
     }

Any help?? THanks in advance

2

2 Answers

1
votes

trying this worked for me

from("direct:send")
.process(queueProcessor)
.to(parallelQueue + "?jmsMessageType=Object")
0
votes

sure, Camel will put an ActiveMQObjectMessage in the queue and you can just cast the message back into your object type...

ActiveMQObjectMessage message = (ActiveMQObjectMessage) message;

MyObject myObj = (MyObject) message.getObject();