How to wait for consumer to complete poll function after stop #410
Closed
mikicho
started this conversation in
Feature Request
Replies: 3 comments 7 replies
-
It may somewhat related to #392 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey! Sorry for the late reply. This is something that we have had raised before and we have noted it as a future exploration task, due to how Consumer works though, this is slightly tricky. |
Beta Was this translation helpful? Give feedback.
7 replies
-
I've taken a stab at this with #454 -- There are a few different ways to go about this, so I'm happy to rework this PR with some guidance if maintainers are opposed to this approach. |
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
TL;DR:
The
start
function is sync but leaves "open" promise that users can'tawait
for.Example:
I have a consumer that prints a log on the
message_processed
event:The problem is that my tests (and the process in production) are completed before the listener gets executed because the
stop
function doesn't wait forpoll
function to complete.Objectives
stop
function should wait for the poll function to complete.OR
Emit
shutdown
event only after thepoll
function is complete instead of inside thestop
function. so users will be able to await forshutdown
eventBeta Was this translation helpful? Give feedback.
All reactions