Add yield (#64)

Simply calls rd_kafka_yield; allows consumers and producers to abort the
current callback dispatcher.
This commit is contained in:
amirshavit
2018-05-23 17:26:09 +01:00
committed by Matias Fontanini
parent d9feb5c3db
commit ee71b3979a
2 changed files with 11 additions and 0 deletions

View File

@@ -200,6 +200,13 @@ public:
* This calls rd_kafka_outq_len
*/
int get_out_queue_length() const;
/**
* \brief Cancels the current callback dispatcher
*
* This calls rd_kafka_yield
*/
void yield() const;
protected:
KafkaHandleBase(Configuration config);

View File

@@ -165,6 +165,10 @@ int KafkaHandleBase::get_out_queue_length() const {
return rd_kafka_outq_len(handle_.get());
}
void KafkaHandleBase::yield() const {
rd_kafka_yield(handle_.get());
}
void KafkaHandleBase::set_handle(rd_kafka_t* handle) {
handle_ = HandlePtr(handle, &rd_kafka_destroy);
}