1

我将 ASB 用于组件之间的入队/出队消息。组件 A 从队列 A 消费消息并从队列 B 产生消息。它消费然后在消费时产生。两个队列都使用具有不同队列名称(A 和 B)的相同 Azure 服务总线。

我的问题是,一旦组件空闲超过 10~15 分钟,然后尝试消费/生产,它就会抛出

javax.jms.IllegalStateException: The MessageProducer was closed due to an unrecoverable error.

Caused by: javax.jms.JMSException: The link 'G5S1:40611071:qpid-jms:sender:ID:bbc3fc62-4377-4aeb-bb80-117d74e780de:1:47:1:queueB' is force detached. Code: publisher(link578). Details: AmqpMessagePublisher.IdleTimerExpired: Idle timeout: 00:10:00. [condition = amqp:link:detach-forced]

在观察堆栈跟踪和行为后,它在尝试向 queueB 生成消息时遇到问题。对于消费者和生产者,我在 MessageGateway bean 中使用同名 bean cachingConnectionFactory()(不确定是否重要)。

我的猜测是,当它消耗时,它会重新启动与 queueA 的连接,而当它尝试重新启动与 queueB 的连接时,会出现问题。

有人有什么想法吗?如果需要更多信息,请告诉我。

4

1 回答 1

0

您是否尝试禁用缓存生产者?类似于:

 CachingConnectionFactory connectionFactory = (CachingConnectionFactory) jmsTemplte.getConnectionFactory();
    
    connectionFactory.setCacheProducers(false);
于 2020-11-25T15:09:10.990 回答