confluentinc / librdkafka

The Apache Kafka C/C++ library
Other
7.37k stars 3.11k forks source link

Question: Can event_cb be called on a stopped producer/consumer? #4622

Closed Pilipets closed 4 months ago

Pilipets commented 4 months ago

Reading through https://github.com/confluentinc/librdkafka/blob/master/INTRODUCTION.md#threads-and-callbacks, I didn't find an answer to my question.

For a stopped producer/consumer, does anything happen in the librdkafka background threads to trigger event_cb being called? I want to reuse one callback among N producers/consumers, so trying to understand the architecture.

Let's say a broker drops a client connection, will the reconnection attempt happen in the background thread or when I do poll/start for the respective producer/consumer?

I'm referring to the

  ExampleEventCb ex_event_cb;
  conf->set("event_cb", &ex_event_cb, errstr);
Pilipets commented 4 months ago

Ok, as far as I can see, the events need to be served manually by calling poll.

/**