本文介绍了在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.
这篇关于在librdkafka中,每次调用produce()后都会调用dr_cb()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!