首页 文章

骆驼:两条路线之间的通信

提问于
浏览
0

我基本上是骆驼新手 . 我设置了一个带有两个使用seda endpoints 的路由的camel上下文 . 简单地说,一切都从一个“来自”文件 endpoints 开始(对于错误的术语而言),在目录上进行监听:

<route>
    <from uri="file:mydir"/>
    <process ref="a bean that change the body of the message by setting a custom object"/>
    <to uri="seda:incoming"/>
</route>
<route>
    <from uri="seda:incoming"/>
    <process ref="a bean that does something with the custom object above"/>
    ....
</route>

现在,上面描述的工作完美但我需要使用activemq队列更改seda,并且在执行此操作后,第二个处理器接收的消息正文为空 .

如何使用activemq通道获得相同的seda endpoints 行为?

1 回答

  • 0

    exchange.getIn() . setBody(myCustomBean)

    exchange.getIn() . setHeader(“inputfile”,aFileInstance)

    如果您希望在从activemq队列中获取时获得一些结果,则应将可序列化对象发送到队列 . 否则对象将不会被转移 . 在您的情况下,不能保证myCustomBean和aFileInstance是可序列化的 . 基本上尝试将字符串发送到队列中 . 或者使您的对象可序列化 .

相关问题