Jms ApacheCamel:在直接访问之后使用文件

Jms ApacheCamel:在直接访问之后使用文件,jms,apache-camel,Jms,Apache Camel,我试图做的是使用一个jms队列发送一条消息,消息体包含文件名和一个头,例如表示要切换到的路由的JMSType。一旦使用direct切换了路由:我希望能够使用消息正文中指示的文件,但我不知道如何正确执行。这就是我在某种伪代码中的意思: from('jms:whatToDo') .choice().header('JMSType') .when('this').to('direct:this') .when('that').to('direct:that') .other

我试图做的是使用一个jms队列发送一条消息,消息体包含文件名和一个头,例如表示要切换到的路由的JMSType。一旦使用direct切换了路由:我希望能够使用消息正文中指示的文件,但我不知道如何正确执行。这就是我在某种伪代码中的意思:

from('jms:whatToDo')
  .choice().header('JMSType')
    .when('this').to('direct:this')
    .when('that').to('direct:that')
    .otherwise().to('direct:nothing')
  .end()

from ('direct:this').from('file:/tmp/${jms-body()}?noop=true')
                .split(body().tokenize('\n'))...etc
我在camel中连续放置了两个from direct:和file:,它们是错误的,但这是为了强调我的意思


您知道如何使用Camel实现吗?

您可以进行消息转换,将要读取的文件的正文设置为java.io.File

from ('direct:this')
  .transform(simple("file:/tmp/${body}", java.io.File.class))
  .split(body().tokenize('\n'))...etc