Closed MaximGurschi closed 8 years ago
Yes. Callbacks only run in Tasks controlled by C# and those are shut down during Dispose.
See for example https://github.com/ah-/rdkafka-dotnet/blob/master/src/RdKafka/Handle.cs#L72.
Edit: Almost, LogCallback are currently different. They're the only callback that's invoked directly from librdkafka without going via a queue/poll. I'm not sure if the LogCallback is ever actually called after rd_kafka_destroy, but it is theoretically possible.
Ok thank you for that.
To conclude - from Magnus:
_Logs may be emitted until rd_kafkadestroy() returns, but not after that. The reason for this is that quite a lot of stuff might go on decommissioning librdkafka and thus logs are usable to find errors or for debugging.
That is good enough for me!
Thanks for investigating.
So the final answer is: Yes, disposing a handle guaratees that no more callbacks are invoked after Dispose returns.
Hello,
I looked at the RdKafka code and i believe that disposing a Handle (producer/(event)consumer) means that there will be no subsequent callbacks (OnError, OnPartitionsAssigned, LogCallbacks, etc.). Can you please confirm if the above is correct and will stay like that?
I just want to make sure that I do not need to protect against subsequent callbacks after calling Dispose.