Reputation: 2162
piece of code below
factory = new PooledConnectionFactory(brokerURL);
connection = factory.createConnection("", "");
connection.start();
Broker URL is a valid host, but the port is not opened. After starting it goes into an infinite reconnection loop
[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.
How can I set the number of reconnections or reduce the retry interval?
thanks in advance
Upvotes: 1
Views: 684
Reputation: 2162
I was using a failover URL without maxReconnectAttempts (defaults to retry forever).
Below is an example maxReconnectAttempts on a failover URL
failover:(tcp://localhost:61616)?maxReconnectAttempts=10
Upvotes: 2