分辩哪个队列在Apache的骆驼使用通配符时
问题描述:
在我的申请,我正在使用Apache的骆驼通配符和我已经定义路线建设者这样叫:分辩哪个队列在Apache的骆驼使用通配符时
从(“ActiveMQ的:队列:* processQueue”) .bean(beanOne “的someMethod”);
虽然发送消息我会发短信给 “{} UNIQUEID .processQueue” 队列,所以我需要得到UNIQUEID内的someMethod的beanOne。
答
完整队列路径位于In
消息的JMSDestination
标头(例如JMS目标为queue://test1.processQueue
)中。您可以使用字符串操作函数来获取所需的uniqueId
。
实施例(uniqueId
将test1
):
@Handler
public void someMethod(@Header("JMSDestination") String jmsDestination) {
String uniqueId = jmsDestination.substring("queue://".length(), jmsDestination.indexOf(".processQueue"));
}