-
For testing purposes, I'd like to be able to shut down my FastStream app after a given number of messages have been processed. For context: I am doing RPC over RabbitMQ, where a client app sends an RPC call and a server app returns a response. By keeping track of the number of processed messages manually via a simple counter, I can successfully shut down my client app after the Nth response has been received. However, I'm unsure how to implement the shutdown in the server app. I cannot simply shut it down from within the message handler because FastStream requires the return value in order to complete the RPC call. I was thinking of sending a signal to initiate a shutdown which would be picked up by a separate signal handler, but I don't know how I can guarantee that the response value has successfully been received by RabbitMQ so that I can safely shut down the server app. Can you advise how I might approach this? Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
All brokers has 'gracefully_timeout' option, guarantee that all handlers will be completed before shutting down. |
Beta Was this translation helpful? Give feedback.
-
Many thanks @Lancetnik! I had missed the |
Beta Was this translation helpful? Give feedback.
All brokers has 'gracefully_timeout' option, guarantee that all handlers will be completed before shutting down.
I think, u can setup this option and just send SIGINT signal in main thread any time (this signal triggers graceful timeout process)