I'm trying to recover the connection in RMQ for Clustered environment but unfortunately i'm not able to recover it in my code and also its not catching in exception..
For example. Initially node 1 is connected and i`m able to handle the messages. To test fail-over, we brought node 2 up and stopped node 1.. connections are being lost which is expected, but retry is not happening.
When i restart my service, i'm able to get exception as "Rabbit MQ Message Exception : Error = 'connection is already closed due to connection error; cause: java.net.SocketException: Connection reset'"
Can anyone please suggest how to recover it in such case?
Have used below configurations in my code. (AMQP client)
factory.setAutomaticRecoveryEnabled(true);
factory.setNetworkRecoveryInterval(5000);
factory.setTopologyRecoveryEnabled(true);
factory.setRequestedHeartbeat(60);
By using Lyra connection recovery will occur with following config
.withRetryPolicy(new RetryPolicy()
.withMaxAttempts(30)
.withInterval(Duration.seconds(1))
.withMaxDuration(Duration.minutes(5)));
Please understand that this is not a client issue: for some reason,
TCP connection to RabbitMQ is reset. It can be due to a variety of reasons
but the primary suspects are:
An intermediary (proxy, firewall, etc) terminates it
I'm trying to recover the connection in RMQ for Clustered environment but unfortunately i'm not able to recover it in my code and also its not catching in exception..
For example. Initially node 1 is connected and i`m able to handle the messages. To test fail-over, we brought node 2 up and stopped node 1.. connections are being lost which is expected, but retry is not happening. When i restart my service, i'm able to get exception as "Rabbit MQ Message Exception : Error = 'connection is already closed due to connection error; cause: java.net.SocketException: Connection reset'"
Can anyone please suggest how to recover it in such case?
Have used below configurations in my code. (AMQP client) factory.setAutomaticRecoveryEnabled(true); factory.setNetworkRecoveryInterval(5000); factory.setTopologyRecoveryEnabled(true); factory.setRequestedHeartbeat(60);
By using Lyra connection recovery will occur with following config
.withRetryPolicy(new RetryPolicy() .withMaxAttempts(30) .withInterval(Duration.seconds(1)) .withMaxDuration(Duration.minutes(5)));
Please understand that this is not a client issue: for some reason, TCP connection to RabbitMQ is reset. It can be due to a variety of reasons but the primary suspects are: