![](/img/trans.png)
[英]Consuming message in the correct order from an Advanced Queue by Camel and JMS
[英]Camel: define jms queue name from properites file
我正在嘗試在Spring DSL中使用駱駝中的可配置隊列名稱定義jms偵聽器。 接下來是我采用硬編碼值的方法:
<from uri="jms:queue:update.q?messageConverter=#messageConverter"/>
並且對隊列名稱update.q
要使用可配置的隊列名稱,我嘗試了下一種方法:
<from uri="jms:queue:${update.q}?messageConverter=#messageConverter"/>
但它開始偵聽名為${update.q}
隊列,而不是屬性文件中的值。
任何想法如何配置JMS隊列名稱?
提前致謝。
更改為
<from uri="jms:queue:{{update.q}}?messageConverter=#messageConverter"/>
並添加“屬性” bean
<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="classpath:myproperties.properties" />
</bean>
將通配符表示法更改為Spring風格:
<from uri="jms:queue:{{update.q}}?messageConverter=#messageConverter"/>
然后,確保您的屬性文件由Spring屬性占位符注冊:
<context:property-placeholder location="file:///opt/java/my.properties" />
最后,確保您的項目包括必要的Spring Camel集成依賴項,例如:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
</dependency>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.