The Apache Kafka C/C++ client library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RdKafka::Handle Class Referenceabstract

Base handle, super class for specific clients. More...

#include <rdkafkacpp.h>

Inheritance diagram for RdKafka::Handle:

Public Member Functions

virtual const std::string name () const =0
virtual const std::string memberid () const =0
 Returns the client's broker-assigned group member id. More...
virtual int poll (int timeout_ms)=0
 Polls the provided kafka handle for events. More...
virtual int outq_len ()=0
 Returns the current out queue length. More...
virtual ErrorCode metadata (bool all_topics, const Topic *only_rkt, Metadata **metadatap, int timeout_ms)=0
 Request Metadata from broker. More...

Detailed Description

Base handle, super class for specific clients.

Member Function Documentation

virtual const std::string RdKafka::Handle::name ( ) const
pure virtual
the name of the handle
virtual const std::string RdKafka::Handle::memberid ( ) const
pure virtual

Returns the client's broker-assigned group member id.

This currently requires the high-level KafkaConsumer
Last assigned member id, or empty string if not currently a group member.
virtual int RdKafka::Handle::poll ( int  timeout_ms)
pure virtual

Polls the provided kafka handle for events.

Events will trigger application provided callbacks to be called.

The timeout_ms argument specifies the maximum amount of time (in milliseconds) that the call will block waiting for events. For non-blocking calls, provide 0 as timeout_ms. To wait indefinately for events, provide -1.


  • delivery report callbacks (if an RdKafka::DeliveryCb is configured) [producer]
  • event callbacks (if an RdKafka::EventCb is configured) [producer & consumer]
This method must not be used with the RdKafka::KafkaConsumer, use its RdKafka::KafkaConsumer::consume() instead.
the number of events served.
virtual int RdKafka::Handle::outq_len ( )
pure virtual

Returns the current out queue length.

The out queue contains messages and requests waiting to be sent to, or acknowledged by, the broker.

virtual ErrorCode RdKafka::Handle::metadata ( bool  all_topics,
const Topic only_rkt,
Metadata **  metadatap,
int  timeout_ms 
pure virtual

Request Metadata from broker.

Parameters: all_topics - if non-zero: request info about all topics in cluster, if zero: only request info about locally known topics. only_rkt - only request info about this topic metadatap - pointer to hold metadata result. The *metadatap pointer must be released with delete. timeout_ms - maximum response time before failing.

RdKafka::ERR_NO_ERROR on success (in which case *metadatap will be set), else RdKafka::ERR__TIMED_OUT on timeout or other error code on error.

The documentation for this class was generated from the following file: