在librdkafka中,每次调用produce()后都会调用dr_cb()
问题描述:
我正在开发 C++ Kafka 客户端:librdkafka.库在这里 https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.cpp.每次调用Producer类中的produce(),是否调用了dr_cb()函数(见下面代码)?
I am working on C++ Kafka client: librdkafka. The lib is here https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.cpp. Each time produce() in Producer class is called, is the dr_cb() function (see the following code) called?
/**
* Delivery Report callback class
*/
class DeliveryReportCb {
public:
virtual void dr_cb (Message &message) = 0;
};
答
交付报告回调 (dr_cb
) 仅在应用程序调用 poll()
时调用生产者句柄,它们不是从 produce()
调用中调用的.
The delivery report callbacks (dr_cb
) are only called when the application calls poll()
on the Producer handle, they are not called from within the produce()
call.