下面的代码
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.
如何设置重新连接次数或减少重试间隔?
提前致谢
答案 0 :(得分:1)
我使用的是没有maxReconnectAttempts的故障转移URL(默认为永久重试)。
以下是故障转移URL上的maxReconnectAttempts示例
failover:(tcp://localhost:61616)?maxReconnectAttempts=10