Support waiting for a batch to complete before shutting down #392
Closed
JavaScriptBach
started this conversation in
Feature Request
Replies: 1 comment
-
Hmmm, I'm not really sure what you mean here. The stop event is emitted immediately, but everything is actually stopped immediately unless you call it with abort, like so: If you don't do that than anything ongoing will still happen after the event. Are you asking for the event to be emitted when these ongoing events have actually stopped? I'm not actually sure how possible that is as the consumer doesn't really have any idea of the requests that are ongoing, it doesn't track them and it doesn't feel too useful to me honestly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Currently
stop()
prevents any future polls and returns immediately. The user is responsible for waiting and handling any pre-existing requests.It would be great if the library could provide first-class support for this. A common use case is to shut down cleanly as follows:
Looking at the code, it seems like I can sort-of accomplish this by listening on "message_received", although it would be complicated to handle batches correctly. In general this seems like code that is best implemented correctly once in the library so customers can get it for free.
Objectives
Support cleanly shutting down a consumer without having to cancel in-flight requests.
Beta Was this translation helpful? Give feedback.
All reactions