带有Camel,MessageProducer的Azure Service Bus(ASB)已关闭(amqp:link:detach-forced)

时间:2019-06-11 13:17:03

标签: apache-camel amqp azureservicebus

我正在使用Apache Camel和camel-amqp组件以便与ASB队列进行通信。

<bean id="jmsConnectionFactory" class="org.apache.qpid.jms.JmsConnectionFactory">
    <property name="remoteURI" value="amqps://${service.bus.uri}?amqp.idleTimeout=120000" />
    <property name="username" value="${service.bus.username}" />
    <property name="password" value="${service.bus.password}" />    
    <property name="receiveLocalOnly" value="true" />
</bean>
<bean id="jmsCachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="jmsCachingConnectionFactory"/>
    <property name="cacheLevelName" value="CACHE_CONSUMER"/>
</bean>
...
<route>
    ...
    <to uri="amqp:queue:{{service.bus.queue}}?exchangePattern=InOnly"/>
</route>

为{{service.bus.queue}}创建了我的路线第一次运行AmqpFixedProducer。如果我设法重新运行路线(10分钟后),则出现以下错误:

Caused by: javax.jms.JMSException: The link 'G24:360891:qpid-jms:sender:ID:b60452dd-5a2e-4478-a462-7ca280ecd953:1:2:1:themis-test' is force detached by the broker due to errors occurred in publisher(link252). Detach origin: AmqpMessagePublisher.IdleTimerExpired: Idle timeout: 00:10:00. [condition = amqp:link:detach-forced]
    at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:164)[149:org.apache.qpid.jms.client:0.26.0.redhat-1]
    at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:117)[149:org.apache.qpid.jms.client:0.26.0.redhat-1]
    at org.apache.qpid.jms.provider.amqp.AmqpAbstractResource.processRemoteClose(AmqpAbstractResource.java:262)[149:org.apache.qpid.jms.client:0.26.0.redhat-1]
    at org.apache.qpid.jms.provider.amqp.AmqpProvider.processUpdates(AmqpProvider.java:903)[149:org.apache.qpid.jms.client:0.26.0.redhat-1]
    at org.apache.qpid.jms.provider.amqp.AmqpProvider.access$1800(AmqpProvider.java:101)[149:org.apache.qpid.jms.client:0.26.0.redhat-1]
    at org.apache.qpid.jms.provider.amqp.AmqpProvider$17.run(AmqpProvider.java:789)[149:org.apache.qpid.jms.client:0.26.0.redhat-1]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_111]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_111]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_111]
    at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]

似乎在10分钟后关闭了与ASB的连接后,应用程序对两个调用使用了相同的生成器。

我的问题是我该如何管理?

是否有一种方法来检索由Camel自动创建的生产者,并关闭OnException部分并再次重试?如何获得制作人?

非常感谢!

1 个答案:

答案 0 :(得分:0)

问题已解决,方法是将 cacheLevelName 修改为 CACHE_NONE 而不是CACHE_CONSUMER。

<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
   <property name="connectionFactory" ref="jmsCachingConnectionFactory"/>
   <property name="cacheLevelName" value="CACHE_NONE"/>
</bean>