Camel: retrieving object in activemq message

谁说我不能喝 提交于 2020-02-05 13:07:35

问题


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


回答1:


trying this worked for me

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



回答2:


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();



来源:https://stackoverflow.com/questions/18129983/camel-retrieving-object-in-activemq-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!