durdin85 commented on code in PR #14677:
URL: https://github.com/apache/cloudstack/pull/14677#discussion_r4644157580
##########
plugins/event-bus/rabbitmq/src/main/java/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java:
##########
@@ -540,35 +649,38 @@ public void shutdownCompleted(ShutdownSignalException
shutdownSignalException) {
}
abortConnection(); // disconnected to AMQP server, so abort
the connection and channels
+ // the ReconnectionTask started with the event bus takes care
of the re-connect
logger.warn("Connection has been shutdown by AMQP server.
Attempting to reconnect.");
-
- // initiate re-connect process
- ReconnectionTask reconnect = new ReconnectionTask();
- executorService.submit(reconnect);
}
}
}
- // retry logic to connect back to AMQP server after loss of connection
+ // runs for the lifetime of the event bus: connects back to AMQP server
after any loss of connection
+ // and sends the events buffered in the meantime
private class ReconnectionTask extends ManagedContextRunnable {
- boolean connected = false;
Connection connection = null;
@Override
protected void runInContext() {
- while (!connected) {
+ while (true) {
Review Comment:
Thanks @DaanHoogland for review, I'll take a look on this. The old while
task ended after one successful connect if I am not mistaken, and a new one was
spawned per disconnect, whereas now one task lives as long as the bus and does
all reconnecting and flushing, but maybe it is a good idea to redo it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]