我目前正在使用ServiceMix使用QPID库路由邮件。
我的工作配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent">
<property name="connectionFactory">
<bean class="org.apache.qpid.jms.JmsConnectionFactory">
<property name="remoteURI" value="failover:amqps://remote-broker:9551?transport.trustStoreLocation=/vault/QA_UM_A.jks />
</bean>
</property>
</bean>
<bean id="kubeActivemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://10.100.10.13:61616" />
</bean>
<route>
<from uri="amqp:queue:///queue-1" />
<to uri="kubeActivemq:local-queue?jmsMessageType=Text" />
</route>
</camelContext>
</blueprint>
以上配置有效。
现在我需要实现持久订阅,这样如果servicemix关闭,它就能够在它恢复时恢复所有消息(当servicemix关闭时发送的消息。)
基于documentation,我实施了一条路线:
<route>
<from uri="amqp:queue:///queue-1?clientId=1&durableSubscriptionName=bar1" />
<to uri="kubeActivemq:queue:///local-queue" />
</route>
但是这个实现给出了错误:
2018-05-28 13:28:58,421 | ERROR | mix-7.0.0/deploy | BlueprintCamelContext | 40 - org.apache.camel.camel-blueprint - 2.16.4 | Error occurred during starting Camel: CamelContext(camel-1) due A durable subscription requires a topic (pub-sub domain)
java.lang.IllegalArgumentException: A durable subscription requires a topic (pub-sub domain)
at org.springframework.jms.listener.AbstractMessageListenerContainer.validateConfiguration(AbstractMessageListenerContainer.java:435)
at org.springframework.jms.listener.AbstractJmsListeningContainer.afterPropertiesSet(AbstractJmsListeningContainer.java:157)
at org.apache.camel.component.jms.JmsConsumer.prepareAndStartListenerContainer(JmsConsumer.java:163)
at org.apache.camel.component.jms.JmsConsumer.doStart(JmsConsumer.java:155)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3234)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3528)
at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3464)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3394)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3162)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3018)
.
.
.
我在这里错过了什么吗?主题名称是否应该与队列名称相同?
答案 0 :(得分:0)
您的路线指示Camel连接到队列,您需要对其进行更改以对持久订阅使用“主题”。 (默认情况下,队列订阅是持久的)
amqp:queue:/// queue-1 ...
“持久订阅”需要一个主题
amqp:topic:/// topic-1 ...