Modern C++ Kafka API
Public Member Functions | Static Public Attributes | List of all members
KAFKA_API::clients::Config Class Reference

Configuration for Kafka clients. More...

#include <ClientConfig.h>

Inheritance diagram for KAFKA_API::clients::Config:
KAFKA_API::Properties KAFKA_API::clients::admin::AdminClientConfig KAFKA_API::clients::consumer::ConsumerConfig KAFKA_API::clients::producer::ProducerConfig

Public Member Functions

 Config (const Config &)=default
 
 Config (const PropertiesMap &kvMap)
 
- Public Member Functions inherited from KAFKA_API::Properties
 Properties (const Properties &)=default
 
 Properties (PropertiesMap kvMap)
 
bool operator== (const Properties &rhs) const
 
template<class T >
Propertiesput (const std::string &key, const T &value)
 Set a property. More...
 
void remove (const std::string &key)
 Remove the property (if one exists).
 
bool contains (const std::string &key) const
 Check whether the map contains a property.
 
template<class T >
T & get (const std::string &key) const
 Get a property reference. More...
 
Optional< std::string > getProperty (const std::string &key) const
 Get a property.
 
void eraseProperty (const std::string &key)
 Remove a property.
 
std::string toString () const
 
const PropertiesMap & map () const
 Get all properties with a map.
 

Static Public Attributes

static constexpr const char * ENABLE_MANUAL_EVENTS_POLL = "enable.manual.events.poll"
 To poll the events manually (otherwise, it would be done with a background polling thread). More...
 
static constexpr const char * LOG_CB = "log_cb"
 Log callback. More...
 
static constexpr const char * ERROR_CB = "error_cb"
 Log callback. More...
 
static constexpr const char * STATS_CB = "stats_cb"
 Statistics callback. More...
 
static constexpr const char * OAUTHBEARER_TOKEN_REFRESH_CB = "oauthbearer_token_refresh_cb"
 OAUTHBEARER token refresh callback. More...
 
static constexpr const char * INTERCEPTORS = "interceptors"
 Interceptors for thread start/exit, brokers' state change, etc. More...
 
static constexpr const char * BOOTSTRAP_SERVERS = "bootstrap.servers"
 The string contains host:port pairs of brokers (splitted by ",") that the consumer will use to establish initial connection to the Kafka cluster. More...
 
static constexpr const char * CLIENT_ID = "client.id"
 Client identifier.
 
static constexpr const char * LOG_LEVEL = "log_level"
 Log level (syslog(3) levels).
 
static constexpr const char * SOCKET_TIMEOUT_MS = "socket.timeout.ms"
 Timeout for network requests. More...
 
static constexpr const char * SECURITY_PROTOCOL = "security.protocol"
 Protocol used to communicate with brokers. More...
 
static constexpr const char * SASL_MECHANISM = "sasl.mechanisms"
 SASL mechanism to use for authentication. More...
 
static constexpr const char * SASL_USERNAME = "sasl.username"
 SASL username for use with the PLAIN and SASL-SCRAM-. More...
 
static constexpr const char * SASL_PASSWORD = "sasl.password"
 SASL password for use with the PLAIN and SASL-SCRAM-. More...
 
static constexpr const char * SASL_KERBEROS_KINIT_CMD = "sasl.kerberos.kinit.cmd"
 Shell command to refresh or acquire the client's Kerberos ticket.
 
static constexpr const char * SASL_KERBEROS_SERVICE_NAME = "sasl.kerberos.service.name"
 The client's Kerberos principal name.
 
static constexpr const char * SASL_OAUTHBEARER_METHOD = "sasl.oauthbearer.method"
 Set to "default" or "oidc" to control with login method to be used. More...
 
static constexpr const char * SASL_OAUTHBEARER_CLIENT_ID = "sasl.oauthbearer.client.id"
 Public identifier for the applicaition. More...
 
static constexpr const char * SASL_OAUTHBEARER_CLIENT_SECRET = "sasl.oauthbearer.client.secret"
 Client secret only known to the application and the authorization server. More...
 
static constexpr const char * SASL_OAUTHBEARER_EXTENSIONS = "sasl.oauthbearer.extensions"
 Allow additional information to be provided to the broker. More...
 
static constexpr const char * SASL_OAUTHBEARER_SCOPE = "sasl.oauthbearer.scope"
 Client use this to specify the scope of the access request to the broker. More...
 
static constexpr const char * SASL_OAUTHBEARER_TOKEN_ENDPOINT_URL = "sasl.oauthbearer.token.endpoint.url"
 OAuth/OIDC issuer token endpoint HTTP(S) URI used to retreve token. More...
 
static constexpr const char * SASL_OAUTHBEARER_CONFIG = "sasl.oauthbearer.config"
 SASL/OAUTHBEARER configuration. More...
 
static constexpr const char * ENABLE_SASL_OAUTHBEARER_UNSECURE_JWT = "enable.sasl.oauthbearer.unsecure.jwt"
 Enable the builtin unsecure JWT OAUTHBEARER token handler if no oauthbearer_refresh_cb has been set. More...
 

Additional Inherited Members

- Public Types inherited from KAFKA_API::Properties
using PropertiesMap = std::map< std::string, ValueType >
 

Detailed Description

Configuration for Kafka clients.

Member Data Documentation

◆ BOOTSTRAP_SERVERS

constexpr const char* KAFKA_API::clients::Config::BOOTSTRAP_SERVERS = "bootstrap.servers"
staticconstexpr

The string contains host:port pairs of brokers (splitted by ",") that the consumer will use to establish initial connection to the Kafka cluster.

Note: It's mandatory.

◆ ENABLE_MANUAL_EVENTS_POLL

constexpr const char* KAFKA_API::clients::Config::ENABLE_MANUAL_EVENTS_POLL = "enable.manual.events.poll"
staticconstexpr

To poll the events manually (otherwise, it would be done with a background polling thread).

Note: Once it's enabled, the interface pollEvents() should be manually called, in order to trigger 1) The offset-commit callbacks, for consumers. 2) The message-delivery callbacks, for producers.

◆ ENABLE_SASL_OAUTHBEARER_UNSECURE_JWT

constexpr const char* KAFKA_API::clients::Config::ENABLE_SASL_OAUTHBEARER_UNSECURE_JWT = "enable.sasl.oauthbearer.unsecure.jwt"
staticconstexpr

Enable the builtin unsecure JWT OAUTHBEARER token handler if no oauthbearer_refresh_cb has been set.

Should only be used for development or testing, and not in production. Default value: false

◆ ERROR_CB

constexpr const char* KAFKA_API::clients::Config::ERROR_CB = "error_cb"
staticconstexpr

Log callback.

Type: std::function<void(const Error&)>

◆ INTERCEPTORS

constexpr const char* KAFKA_API::clients::Config::INTERCEPTORS = "interceptors"
staticconstexpr

Interceptors for thread start/exit, brokers' state change, etc.

Type: Interceptors

◆ LOG_CB

constexpr const char* KAFKA_API::clients::Config::LOG_CB = "log_cb"
staticconstexpr

Log callback.

Type: std::function<void(int, const char*, int, const char* msg)>

◆ OAUTHBEARER_TOKEN_REFRESH_CB

constexpr const char* KAFKA_API::clients::Config::OAUTHBEARER_TOKEN_REFRESH_CB = "oauthbearer_token_refresh_cb"
staticconstexpr

OAUTHBEARER token refresh callback.

Type: std::function<SaslOauthbearerToken(const std::string&)>

◆ SASL_MECHANISM

constexpr const char* KAFKA_API::clients::Config::SASL_MECHANISM = "sasl.mechanisms"
staticconstexpr

SASL mechanism to use for authentication.

Default value: GSSAPI

◆ SASL_OAUTHBEARER_CLIENT_ID

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_CLIENT_ID = "sasl.oauthbearer.client.id"
staticconstexpr

Public identifier for the applicaition.

Only used with "sasl.oauthbearer.method=oidc".

◆ SASL_OAUTHBEARER_CLIENT_SECRET

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_CLIENT_SECRET = "sasl.oauthbearer.client.secret"
staticconstexpr

Client secret only known to the application and the authorization server.

Only used with "sasl.oauthbearer.method=oidc".

◆ SASL_OAUTHBEARER_CONFIG

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_CONFIG = "sasl.oauthbearer.config"
staticconstexpr

SASL/OAUTHBEARER configuration.

The format is implementation-dependent and must be parsed accordingly.

◆ SASL_OAUTHBEARER_EXTENSIONS

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_EXTENSIONS = "sasl.oauthbearer.extensions"
staticconstexpr

Allow additional information to be provided to the broker.

Comma-separated list of key=value pairs. Only used with "sasl.oauthbearer.method=oidc".

◆ SASL_OAUTHBEARER_METHOD

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_METHOD = "sasl.oauthbearer.method"
staticconstexpr

Set to "default" or "oidc" to control with login method to be used.

If set to "oidc", the following properties must also be specified: sasl.oauthbearer.client.id sasl.oauthbearer.client.secret sasl.oauthbearer.token.endpoint.url Default value: default

◆ SASL_OAUTHBEARER_SCOPE

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_SCOPE = "sasl.oauthbearer.scope"
staticconstexpr

Client use this to specify the scope of the access request to the broker.

Only used with "sasl.oauthbearer.method=oidc".

◆ SASL_OAUTHBEARER_TOKEN_ENDPOINT_URL

constexpr const char* KAFKA_API::clients::Config::SASL_OAUTHBEARER_TOKEN_ENDPOINT_URL = "sasl.oauthbearer.token.endpoint.url"
staticconstexpr

OAuth/OIDC issuer token endpoint HTTP(S) URI used to retreve token.

Only used with "sasl.oauthbearer.method=oidc".

◆ SASL_PASSWORD

constexpr const char* KAFKA_API::clients::Config::SASL_PASSWORD = "sasl.password"
staticconstexpr

SASL password for use with the PLAIN and SASL-SCRAM-.

. mechanism.

◆ SASL_USERNAME

constexpr const char* KAFKA_API::clients::Config::SASL_USERNAME = "sasl.username"
staticconstexpr

SASL username for use with the PLAIN and SASL-SCRAM-.

. mechanism.

◆ SECURITY_PROTOCOL

constexpr const char* KAFKA_API::clients::Config::SECURITY_PROTOCOL = "security.protocol"
staticconstexpr

Protocol used to communicate with brokers.

Default value: plaintext

◆ SOCKET_TIMEOUT_MS

constexpr const char* KAFKA_API::clients::Config::SOCKET_TIMEOUT_MS = "socket.timeout.ms"
staticconstexpr

Timeout for network requests.

Default value: 60000

◆ STATS_CB

constexpr const char* KAFKA_API::clients::Config::STATS_CB = "stats_cb"
staticconstexpr

Statistics callback.

Type: std::function<void(const std::string&)>


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