-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to clear message queue? #990
Comments
By the way, thank you for this lib! :) |
As a workaround I can dump new messages to file instead of messages in queue. |
There's been a couple of similar feature requests previously, so something like this is on the roadmap. In my mind there are two API alternatives, which one would you prefer (or something else?):
Also: And what about messages that are in-flight to the broker, should they be included? |
I would choose |
Exactly, the in-flight message are those that have been sent to the broker but we still havent received an ack for. Messages can be in three different states in librdkafka:
purge() wont need to bother with 3. since they are already queued for the delivery report callbacks. |
API suggestion:
Usage example - purge queued but not transmitted messages, then wait for in-transit messages to finish:
(the poll is not really necessary since flush() does the same thing, but this is a bit more elaborate) |
@edenhill, is |
Yes, rkb_outbufs are buffers waiting to be transmitted while rkb_waitresp are buffers that have been transmitted that we're waiting response for. |
+1 on this feature request for me. workarounds like lowering the message queue timeout don't work for me because I purposely want a good sized message queue time most of the time; only when I'm shutting down forcibly to I want to be able to cause shorter timeouts. I need the messages to resolve to avoid leaking. |
Understood. I guess it sort of makes sense to forcibly flush messages in queue on rd_kafka_destroy() and trigger the dr callbacks, seeing how the application will otherwise leak memory (in the case of pointer sharing). The backside is that the rd_kafka_destroy() call will then change behaviour and possibly be unsafe for existing applications. |
Yeah... my use case where this came up is a mirroring/transformation case, and there is bookkeeping and storage management stuff I need to do that wants every production attempt to end up in a DR callback. |
+1 on this feature request for me |
Hi, @edenhill |
Description
Is there a way to remove all messages from message queue when it is full (ENOBUFS)? I want to dump all messages to a file and clear the queue.
The text was updated successfully, but these errors were encountered: