Reputation: 1729
I maintain a connection to a RabbitMQ server. When I safely turn the Rails Server off (via CTRL+C or whatever), how do I trigger a close to that connection?
I need an 'On shutdown' trigger. Is there one?
Upvotes: 1
Views: 277
Reputation: 684
If you are using puma
as your webserver you can add on_worker_shutdown
as a callback and then execute a shell script or whatever else is needed to close the connection to RabbitMQ.
Upvotes: 4