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

Topic+Partition. More...

#include <rdkafkacpp.h>

Public Member Functions

virtual const std::string & topic () const =0
 
virtual int partition () const =0
 
virtual int64_t offset () const =0
 
virtual void set_offset (int64_t offset)=0
 Set offset.
 
virtual ErrorCode err () const =0
 
virtual int32_t get_leader_epoch ()=0
 Get partition leader epoch, or -1 if not known or relevant.
 
virtual void set_leader_epoch (int32_t leader_epoch)=0
 Set partition leader epoch.
 
virtual std::vector< unsigned char > get_metadata ()=0
 Get partition metadata.
 
virtual void set_metadata (std::vector< unsigned char > &metadata)=0
 Set partition metadata.
 

Static Public Member Functions

static TopicPartitioncreate (const std::string &topic, int partition)
 Create topic+partition object for topic and partition. More...
 
static TopicPartitioncreate (const std::string &topic, int partition, int64_t offset)
 Create topic+partition object for topic and partition with offset offset. More...
 
static void destroy (std::vector< TopicPartition * > &partitions)
 Destroy/delete the TopicPartitions in partitions and clear the vector.
 

Detailed Description

Topic+Partition.

This is a generic type to hold a single partition and various information about it.

Is typically used with std::vector<RdKafka::TopicPartition*> to provide a list of partitions for different operations.

Member Function Documentation

◆ create() [1/2]

static TopicPartition* RdKafka::TopicPartition::create ( const std::string &  topic,
int  partition 
)
static

Create topic+partition object for topic and partition.

Use delete to deconstruct.

◆ create() [2/2]

static TopicPartition* RdKafka::TopicPartition::create ( const std::string &  topic,
int  partition,
int64_t  offset 
)
static

Create topic+partition object for topic and partition with offset offset.

Use delete to deconstruct.

◆ topic()

virtual const std::string& RdKafka::TopicPartition::topic ( ) const
pure virtual
Returns
topic name

◆ partition()

virtual int RdKafka::TopicPartition::partition ( ) const
pure virtual
Returns
partition id

◆ offset()

virtual int64_t RdKafka::TopicPartition::offset ( ) const
pure virtual
Returns
offset (if applicable)

◆ err()

virtual ErrorCode RdKafka::TopicPartition::err ( ) const
pure virtual
Returns
error code (if applicable)

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