在librdkafka中,每次在调用generate()之后调用dr_cb() [英] In librdkafka, dr_cb() is called each time after produce() called

查看:196
本文介绍了在librdkafka中,每次在调用generate()之后调用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;
};

推荐答案

仅当应用程序在服务器上调用 poll()时,才会调用传递报告回调( dr_cb ).生产者句柄,不会在 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中,每次在调用generate()之后调用dr_cb()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆