Closed alter123 closed 2 years ago
I'm also interested in the correct way to shutdown the consumers gracefully.
Reading through the docs, I can't find a complete example but looks like we should first call StopConsuming(consumerName)
and then Disconnect()
I updated the consumer example and it appears to work ok.
example given in #51
Seems like StopConsuming was removed in previous releases. How is the current approach for a graceful shutdown of in-flight consumer goroutines? I don't see a way in the current code base how one could wait for running handlers to finish their work and even more important, to send a final ACK before the consumer is finally closed.
I'm been wondering the same. We should be able to gracefully shutdown the consumers.
Looks like there is no way to achieve graceful shutdown with go-rabbitmq. I'm planning to move to the amqp091-go because of this.
@wagslane Please clarify if graceful shutdown of in-flight consumer goroutines is possible anymore.
There seems to be missing case while handling SIGINT, SIGTERM signals in the implementation, if the consumers are running in goroutine. One possible implementation can be stop listening to new messages (closing the channel), and provide deadline context to running goroutines.
Would like to know if there can more elegant way for handling these case, also open for contributing.