简体   繁体   English

如何从Apache Camel中的Header值设置队列名称

[英]How to set Queue name from Header value in Apache Camel

Im trying to set activemq queue name from header value but its not happening below is my Spring DSL 我试图从标题值设置activemq队列名称,但下面没有发生是我的Spring DSL

<setHeader headerName="x-so-queue-name" id="_setHeader1">
   <xpath resultType="java.lang.String">/Message/@IntObjectName</xpath>
</setHeader>
<log id="_log1" message="x-so-queue-name::: ${header.x-so-queue-name}"/>
<to id="_to1" uri="activemq:queue:${header.x-so-queue-name}"/>

LOGS 16:03:57,601 | 日志 16:03:57,601 | INFO | 信息| _route1 | _route1 | x-so-queue-name::: IDC_SO_Refill_IO x-so-queue-name ::: IDC_SO_Refill_IO

header value is printing in the logs but queue name is set to "${header.x-so-queue-name}" why its not retrieving the the value for header, am i doing some thing wrong 标头值正在日志中打印,但是队列名称设置为“ $ {header.x-so-queue-name}”,为什么它没有检索标头的值,我在做错什么吗

在此处输入图片说明

  1. Replace the 'x-so-queue-name' header name with the header named 'CamelJmsDestinationName' 用名为“ CamelJmsDestinationName”的标题替换“ x-so-queue-name”标题名称

  2. Then in the uri, remove the ${header.x-so-queue-name}.. you can put whatever queue name you want, since the ActiveMQ component will look at the header to determine the destination name. 然后在uri中,删除$ {header.x-so-queue-name} ..您可以放入所需的任何队列名称,因为ActiveMQ组件将查看标头以确定目标名称。 I generally use the below, as a reminder that I'm using dynamic queue naming in the route: 我通常使用以下内容来提醒我在路由中使用动态队列命名:

Reference: Camel JMS Component (search for CamelJmsDestinationName) 参考: Camel JMS组件(搜索CamelJmsDestinationName)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM