I'm using a CachingConnectionFactory and after a primary broker goes down it connects to the secondary. After restarting the primary broker I want to reconnect to it. Can this be done automatically?
This is what I've tried and it doesn't work:
factory.setRecoveryListener(new RecoveryListener() {
@Override
public void handleRecovery(final Recoverable recoverable) {
factory.resetConnection();
}
@Override
public void handleRecoveryStarted(final Recoverable recoverable) {
factory.resetConnection();
}
});
Can the factory be setup to take care of resetting the connection after the primary broker is back up?