Modern C++ Kafka API
Public Types | Public Member Functions | List of all members
KAFKA_API::clients::KafkaClient Class Reference

The base class for Kafka clients. More...

#include <KafkaClient.h>

Inheritance diagram for KAFKA_API::clients::KafkaClient:
KAFKA_API::clients::admin::AdminClient KAFKA_API::clients::consumer::KafkaConsumer KAFKA_API::clients::producer::KafkaProducer

Public Types

enum  { DEFAULT_METADATA_TIMEOUT_MS = 10000 }
 

Public Member Functions

const std::string & clientId () const
 Get the client id.
 
const std::string & name () const
 Get the client name (i.e. More...
 
void setLogLevel (int level)
 Set log level for the kafka client (the default value: 5).
 
const Propertiesproperties () const
 Return the properties which took effect.
 
Optional< std::string > getProperty (const std::string &name) const
 Fetch the effected property (including the property internally set by librdkafka).
 
void pollEvents (std::chrono::milliseconds timeout)
 Call the OffsetCommit callbacks (if any) Note: The Kafka client should be constructed with option enable.manual.events.poll=true!
 
Optional< BrokerMetadatafetchBrokerMetadata (const std::string &topic, std::chrono::milliseconds timeout=std::chrono::milliseconds(DEFAULT_METADATA_TIMEOUT_MS), bool disableErrorLogging=false)
 Fetch matadata from a available broker. More...
 
template<class ... Args>
void doLog (int level, const char *filename, int lineno, const char *format, Args... args) const
 
void doLog (int level, const char *filename, int lineno, const char *msg) const
 

Detailed Description

The base class for Kafka clients.

Member Function Documentation

◆ fetchBrokerMetadata()

Optional< BrokerMetadata > KAFKA_API::clients::KafkaClient::fetchBrokerMetadata ( const std::string &  topic,
std::chrono::milliseconds  timeout = std::chrono::milliseconds(DEFAULT_METADATA_TIMEOUT_MS),
bool  disableErrorLogging = false 
)
inline

Fetch matadata from a available broker.

Note: the Metadata response information may trigger a re-join if any subscribed topic has changed partition count or existence state.

◆ name()

const std::string& KAFKA_API::clients::KafkaClient::name ( ) const
inline

Get the client name (i.e.

client type + id).


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