-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Reconnect rabbitmq #1878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconnect rabbitmq #1878
Conversation
… and shutdown procedures
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
melhorias em reconexões no rabbitmqController
Summary by Sourcery
Enhance RabbitMQController reconnection robustness by centralizing resource cleanup and adding typed error handling
Enhancements: