librdkafka
The Apache Kafka C/C++ client library
RdKafka::PartitionerCb Class Referenceabstract

Partitioner callback class. More...

#include <rdkafkacpp.h>

Public Member Functions

virtual int32_t partitioner_cb (const Topic *topic, const std::string *key, int32_t partition_cnt, void *msg_opaque)=0
 Partitioner callback. More...
 

Detailed Description

Partitioner callback class.

Generic partitioner callback class for implementing custom partitioners.

See also
RdKafka::Conf::set() "partitioner_cb"

Member Function Documentation

◆ partitioner_cb()

virtual int32_t RdKafka::PartitionerCb::partitioner_cb ( const Topic topic,
const std::string *  key,
int32_t  partition_cnt,
void *  msg_opaque 
)
pure virtual

Partitioner callback.

Return the partition to use for key in topic.

The msg_opaque is the same msg_opaque provided in the RdKafka::Producer::produce() call.

Remarks
key may be NULL or the empty.
Returns
Must return a value between 0 and partition_cnt (non-inclusive). May return RD_KAFKA_PARTITION_UA (-1) if partitioning failed.
See also
The callback may use RdKafka::Topic::partition_available() to check if a partition has an active leader broker.

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