Apache Camel inOut路由,与jaxb交换交换封送/取消封送 [英] Apache Camel inOut routes, out exchange marshaling/unmarshaling with jaxb

查看:197
本文介绍了Apache Camel inOut路由,与jaxb交换交换封送/取消封送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有这个apache骆驼路线,

we have this apache camel route,

from(commandDrop).marshal(jaxbDataFormat).to(jmsQueue);    
from(jmsQueue).inOut("jms:doCommand?requestTimeout=500000");          
from("jms:doCommand").unmarshal(jaxbDataFormat).beanRef("bean");

....和这样的bean类

.... and a bean class like this

class BeanClass {
        public void doCommand(Command command, Exchange exchange){
    {       
        command.run();      
        exchange.getOut().setBody(command);     
    }
}

我们试图发布消息并等待回复在这样的路线上

we trying to put a message and wait for a reply on the route like this

Object ret = template.requestBody(commandDrop, new TestCommand());

正向路线上的对象变得出色/混乱。但是setBody调用导致java.io.NotSerializableException。有没有一种方法可以配置路由以在回程中使用相同的jaxb封送处理/取消封送处理?我的Command类包含一些jaxb生成的无法序列化的类对象。元帅/元帅在向前的方向上可以很好地处理它们,如果可以在返回的途中,它们会很棒。骆驼相对较新,因此不确定这是否是解决此问题的最佳方法。

Objects on the route in the forward direction are getting marshaled/unmarshaled splendidly. But the setBody call is causing a java.io.NotSerializableException. Is there a way to configure the route to use the same jaxb marshaling/unmarshaling on the way back? My Command class contain some jaxb- generated class objects that are not serializable. They are handled well by the marshal/unmarshal in the forward direction and would be great if they can be on the way back. Am relatively new to camel so not sure if this is the best way to go about this.

感谢一堆。

推荐答案

您可以在bean调用后将其封送

You can marshal it after the bean invocation

from("jms:doCommand").unmarshal(jaxbDataFormat).beanRef("bean").marshal(jaxbDataFormat);

这篇关于Apache Camel inOut路由,与jaxb交换交换封送/取消封送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆