java - PooledConnectionFactory 处于无限重新连接循环中

标签 java jms activemq

下面的一段代码

factory = new PooledConnectionFactory(brokerURL);
connection = factory.createConnection("", "");
connection.start();

代理 URL 是有效主机,但端口未打开。 启动后进入无限重连循环

[junit] 00:28:54,851  WARN FailoverTransport:1109 - Failed to 
connect to [SOME_URL] after: 10 attempt(s) continuing to retry.
[junit] 00:43:01,629  WARN FailoverTransport:1109 - Failed to 
connect to [SOME_URL] after: 20 attempt(s) continuing to retry.
[junit] 00:58:02,531  WARN FailoverTransport:1109 - Failed to 
connect to [SOME_URL] after: 30 attempt(s) continuing to retry.
[junit] 01:13:08,646  WARN FailoverTransport:1109 - Failed to 
connect to [SOME_URL] after: 40 attempt(s) continuing to retry.
[junit] 01:28:10,021  WARN FailoverTransport:1109 - Failed to 
connect to [SOME_URL] after: 50 attempt(s) continuing to retry.

如何设置重连次数或缩短重试间隔?

提前致谢

最佳答案

我使用的故障转移 URL 没有 maxReconnectAttempts(默认为永远重试)。

下面是故障转移 URL 上的 maxReconnectAttempts 示例

failover:(tcp://localhost:61616)?maxReconnectAttempts=10

关于java - PooledConnectionFactory 处于无限重新连接循环中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29010166/

相关文章:

java - ActiveMQ 管理 Web 控制台错误

ssl - ActiveMQ SSL - 在没有重启代理的情况下重新加载信任库

java - "throws UncheckedException"是否有意义

java - scala 中的 Hello World 有什么问题?

java - 适用于 Android Studio 的 Google AdMob,具有以设定频率随机呈现功能的插页式广告

java - 如何在 Java 中找到 'n' 提升到 'n'

java - 使用具有特定路由键的消息?

java - 如何检查消息发送到 JMS 队列是否成功?

java - ActiveMQ 内存泄漏 - 了解堆中的对象

java - 无法绑定(bind)到 Openshift 上的端口