Reconnect rabbitmq#1878
Merged
DavidsonGomes merged 3 commits intoEvolutionAPI:developfrom Aug 29, 2025
Merged
Conversation
… and shutdown procedures
Contributor
Reviewer's GuideThis PR refactors the RabbitMQ controller’s reconnection flow by adding strong TypeScript annotations for AMQP callbacks, extracting manual teardown logic into a dedicated cleanup() method, and replacing direct resets with safe resource closure and error-handled cleanup before scheduling reconnects. Sequence diagram for RabbitMQ reconnection and cleanup flowsequenceDiagram
participant RabbitmqController
participant amqpConnection
participant amqpChannel
participant Logger
RabbitmqController->>amqpConnection: connect()
alt Connection error
amqpConnection-->>RabbitmqController: error
RabbitmqController->>Logger: log error
RabbitmqController->>RabbitmqController: handleConnectionLoss()
RabbitmqController->>RabbitmqController: cleanup()
RabbitmqController->>RabbitmqController: scheduleReconnect()
else Connection success
amqpConnection->>amqpChannel: createChannel()
alt Channel error
amqpChannel-->>RabbitmqController: error
RabbitmqController->>Logger: log error
RabbitmqController->>RabbitmqController: handleConnectionLoss()
RabbitmqController->>RabbitmqController: cleanup()
RabbitmqController->>RabbitmqController: scheduleReconnect()
end
end
Note over RabbitmqController: cleanup() safely closes channel and connection
Note over RabbitmqController: Errors during cleanup are logged as warnings
Class diagram for updated RabbitmqController cleanup and reconnection logicclassDiagram
class RabbitmqController {
+amqpConnection: amqp.Connection | null
+amqpChannel: amqp.Channel | null
+connect()
+handleConnectionLoss()
+scheduleReconnect()
+cleanup() Promise<void>
}
class Logger {
+error()
+warn()
}
RabbitmqController --> Logger
RabbitmqController : uses amqp.Connection
RabbitmqController : uses amqp.Channel
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
melhorias em reconexões no rabbitmqController
Summary by Sourcery
Enhance RabbitMQController reconnection robustness by centralizing resource cleanup and adding typed error handling
Enhancements: