【问题标题】:Extracting the body from an ActiveMQ message via Camel通过 Camel 从 ActiveMQ 消息中提取正文
【发布时间】:2016-06-07 04:24:09
【问题描述】:

我有一条使用 Spring DSL 的路由

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="activemq:queue:worker?mapJmsMessage=false" />
    <convertBodyTo type="java.lang.String"/>
    <setHeader headerName="CamelHttpMethod">
      <constant>POST</constant>
    </setHeader>
    <to uri="http://localhost/queue" />
  </route>
</camelContext>

消息类型是 ActiveMQTextMessage。我能够将消息发布到 HTTP URL,但我得到的似乎是 toString() 输出:

ActiveMQTextMessage {commandId = 5, responseRequired = false, message....

我想调用 ActiveMQTextMessage 实例上的 getText() 方法来填充路由,但我不知道如何调用该方法。我很确定我可以让它在代码中工作,但我需要通过 XML 完成所有工作。

【问题讨论】:

    标签: apache-camel activemq


    【解决方案1】:

    找出问题所在。几天前我设置了 mapJmsMessage=false 来处理异常。我删除了它,突然它工作正常了。

    【讨论】:

    • 我得等两天才能到
    猜你喜欢
    • 1970-01-01
    • 2022-01-19
    • 2019-04-02
    • 1970-01-01
    • 2013-09-16
    • 2016-02-02
    • 1970-01-01
    • 2016-09-26
    • 1970-01-01
    相关资源
    最近更新 更多