如何在骆驼路线 spring DSL 中设置 JMSCorrelationId 和 JMSReplyTo header

How to set JMSCorrelationId and JMSReplyTo header in camel route spring DSL

我正在尝试使用消息传递 queue (Websphere Mq) 来集成两个系统。我使用带有 spring 的骆驼来进行路由。现在我需要在其中设置 JMSCorrelationId 和 JMSReplyTo header。

      <route id="Request1">
              <from uri="WebMq:queue:inputQ"/>

              <to uri="bean:mycode"/>

              <to uri="WebMq:queue:outputQ"/>

      </route>  

将以下内容放在中间:

<setHeader headerName="JMSCorrelationId">
  <constant>myValue</constant>
</setHeader>

您可以使用 JMSReplyTo header 做同样的事情。

它对我想做的工作很有用。它在请求回复场景中帮助我。

  <route id="Request1">
          <from uri="WebMq:queue:inputQ?replyTo=queue_name pattern="InOut"/>

          <to uri="bean:mycode"/>

          <to uri="WebMq:queue:outputQ"/>

  </route>