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

Topic handle. More...

#include <rdkafkacpp.h>

Public Member Functions

virtual const std::string name () const =0
virtual bool partition_available (int32_t partition) const =0
virtual ErrorCode offset_store (int32_t partition, int64_t offset)=0
 Store offset offset for topic partition partition. The offset will be committed (written) to the offset store according to More...
virtual struct rd_kafka_topic_s * c_ptr ()=0
 Returns the underlying librdkafka C rd_kafka_topic_t handle. More...

Static Public Member Functions

static Topiccreate (Handle *base, const std::string &topic_str, Conf *conf, std::string &errstr)
 Creates a new topic handle for topic named topic_str. More...

Static Public Attributes

static const int32_t PARTITION_UA
 Unassigned partition. More...
static const int64_t OFFSET_BEGINNING
 Special offsets. More...
static const int64_t OFFSET_END
static const int64_t OFFSET_STORED
static const int64_t OFFSET_INVALID

Detailed Description

Topic handle.

Member Function Documentation

static Topic* RdKafka::Topic::create ( Handle base,
const std::string &  topic_str,
Conf conf,
std::string &  errstr 

Creates a new topic handle for topic named topic_str.

conf is an optional configuration for the topic that will be used instead of the default topic configuration. The conf object is reusable after this call.

the new topic handle or NULL on error (see errstr).
virtual const std::string RdKafka::Topic::name ( ) const
pure virtual
the topic name
virtual bool RdKafka::Topic::partition_available ( int32_t  partition) const
pure virtual
true if partition is available for the topic (has leader).
MUST ONLY be called from within a RdKafka::PartitionerCb callback.
virtual ErrorCode RdKafka::Topic::offset_store ( int32_t  partition,
int64_t  offset 
pure virtual

Store offset offset for topic partition partition. The offset will be committed (written) to the offset store according to

Remarks must be set to false when using this API.
RdKafka::ERR_NO_ERROR on success or an error code if none of the offsets could be stored.
virtual struct rd_kafka_topic_s* RdKafka::Topic::c_ptr ( )
pure virtual

Returns the underlying librdkafka C rd_kafka_topic_t handle.

Calling the C API on this handle is not recommended and there is no official support for it, but for cases where the C++ API does not provide the underlying functionality this C handle can be used to interact directly with the core librdkafka API.
The lifetime of the returned pointer is the same as the Topic object this method is called on.
Include <rdkafka/rdkafka.h> prior to including <rdkafka/rdkafkacpp.h>

Field Documentation

const int32_t RdKafka::Topic::PARTITION_UA

Unassigned partition.

The unassigned partition is used by the producer API for messages that should be partitioned using the configured or default partitioner.

const int64_t RdKafka::Topic::OFFSET_BEGINNING

Special offsets.

Consume from beginning

const int64_t RdKafka::Topic::OFFSET_END

Consume from end

const int64_t RdKafka::Topic::OFFSET_STORED

Use offset storage

const int64_t RdKafka::Topic::OFFSET_INVALID

Invalid offset

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