【发布时间】:2015-08-02 17:26:54
【问题描述】:
我有一个问题,我必须将消息广播到不同的输出位置。我正在使用 JMSComponent 来配置我的输出队列。我的输出队列配置是这样的:
ConnectionFactory factory = createOrGetConnectionFactory(brokerUrl);
JmsConfiguration jmsConfiguration = new JmsConfiguration();
jmsConfiguration.setPreserveMessageQos(true);
jmsConfiguration.setConnectionFactory(factory);
counter++;
outputLocations = new StringBuilder("hubOutput"+counter+":queue://queueName");
JmsEndpoint endpoint = new JmsEndpoint();
JmsComponent component = new JmsComponent();
component.setConcurrentConsumers(5);
component.setConfiguration(jmsConfiguration);
component.setConnectionFactory(factory);
//Add new JMS component in the context. This is done so that the output locations having same queue can be differentiated using the component name in camel registry. getContext().addComponent("hubOutput"+counter, component);
endpoint = (JmsEndpoint) component.createEndpoint(outputLocations.toString());
endpoint.setConfiguration(jmsConfiguration);
我有一条骆驼路线,用于将消息广播到输出队列。
from(fromLocation)
.setHeader("hubRoutesList",constant(hubUrl))
.log(urlToLog)
.setExchangePattern(ExchangePattern.InOnly)
.multicast()
.parallelProcessing()
.to(hubUrl.split(","));
所有输出队列都有不同的代理 URL,但队列名称相同。 代码正常工作,但如果其中一个队列关闭,则消息也不会广播到其他队列。
请帮我解决这个问题。
谢谢, 里查
【问题讨论】:
标签: queue jms apache-camel