简体   繁体   English

如果代理不可用,则javax.jms.TemporaryTopic.delete()无限期阻塞

[英]javax.jms.TemporaryTopic.delete() block indefinitely if broker is not available

I have configured ActiveMQ broker with failover. 我已为ActiveMQ代理配置了故障转移。 Any message which is sent with request mode that encounter timeout we delete temporary topic created to listen reply. 以请求方式发送的任何遇到超时的消息,我们都会删除为侦听答复而创建的临时主题。 Now same time my broker gets unavailable and while delete temporary topic thread gets block indefinitely at javax.jms.TemporaryTopic.delete(). 现在,同一时间我的代理不可用,而在删除临时主题线程时,它在javax.jms.TemporaryTopic.delete()处无限期地阻塞。 Please help if anyone has experienced to avoid this. 如果有人有经验请避免这种情况,请提供帮助。

Your only option here as far as I recall is to configure the failover transport to give up trying to reconnect after a certain number of attempts. 据我所知,这里唯一的选择是将故障转移传输配置为放弃经过一定次数的尝试后重新尝试连接。 The time between attempts can be configured as well so you can manage it to some degree. 也可以配置两次尝试之间的时间,因此您可以在一定程度上进行管理。

I am also currently facing this issue. 我目前也正面临这个问题。 So far this is my analysis conclusions. 到目前为止,这是我的分析结论。

To avoid the blocking forever when the broker is not available during Temp topic deletion or sending the messages. 为了避免在临时主题删除或发送消息期间代理不可用时永远避免阻塞。

Suggestion-1: 建议1:

Use maxReconnectAttempts=2 Broker URL Parameter like below. 使用如下所示的maxReconnectAttempts=2代理URL参数。

failover:(tcp://localhost:61616?wireFormat.maxInactivityDuration=120000)?maxReconnectAttempts=2

The connection will be killed when it attempts to reconnect the defined times. 尝试重新连接定义的时间时,该连接将被终止。 So you have to recreate the connection after this. 因此,此后您必须重新创建连接。

Suggestion-2: 建议2:

Use timeout=2000 Broker URL Parameter like below. 使用timeout=2000 Broker URL参数,如下所示。

failover:(tcp://localhost:61616?wireFormat.maxInactivityDuration=120000)?timeout=2000

The connection will not expire. 连接不会过期。 We can reuse the same connection and session when the broker becomes available. 当代理可用时,我们可以重用相同的连接和会话。

It seems Suggestion-2 will be more useful because we will reuse the same Connection and Session. 似乎Recommendation-2将更有用,因为我们将重用相同的Connection和Session。

I will post if find more effective solution to address this situation. 我将发布是否找到更有效的解决方案来解决这种情况。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM