Class AdminClientBuilder
A builder for IAdminClient.
Inheritance
Inherited Members
Namespace: Confluent.Kafka
Assembly: cs.temp.dll.dll
Syntax
public class AdminClientBuilder
Constructors
AdminClientBuilder(IEnumerable<KeyValuePair<String, String>>)
Initialize a new AdminClientBuilder instance.
Declaration
public AdminClientBuilder(IEnumerable<KeyValuePair<string, string>> config)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.String>> | config | A collection of librdkafka configuration parameters (refer to https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md) and parameters specific to this client (refer to: ConfigPropertyNames). At a minimum, 'bootstrap.servers' must be specified. |
Properties
Config
The config dictionary.
Declaration
protected IEnumerable<KeyValuePair<string, string>> Config { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.String>> |
ErrorHandler
The configured error handler.
Declaration
protected Action<IAdminClient, Error> ErrorHandler { get; set; }
Property Value
Type | Description |
---|---|
System.Action<IAdminClient, Error> |
LogHandler
The configured log handler.
Declaration
protected Action<IAdminClient, LogMessage> LogHandler { get; set; }
Property Value
Type | Description |
---|---|
System.Action<IAdminClient, LogMessage> |
OAuthBearerTokenRefreshHandler
The configured OAuthBearer Token Refresh handler.
Declaration
public Action<IProducer<Null, Null>, string> OAuthBearerTokenRefreshHandler { get; set; }
Property Value
Type | Description |
---|---|
System.Action<IProducer<Null, Null>, System.String> |
StatisticsHandler
The configured statistics handler.
Declaration
protected Action<IAdminClient, string> StatisticsHandler { get; set; }
Property Value
Type | Description |
---|---|
System.Action<IAdminClient, System.String> |
Methods
Build()
Build the Confluent.Kafka.AdminClient instance.
Declaration
public virtual IAdminClient Build()
Returns
Type | Description |
---|---|
IAdminClient |
SetErrorHandler(Action<IAdminClient, Error>)
Set the handler to call on error events e.g. connection failures or all brokers down. Note that the client will try to automatically recover from errors that are not marked as fatal. Non-fatal errors should be interpreted as informational rather than catastrophic.
Declaration
public AdminClientBuilder SetErrorHandler(Action<IAdminClient, Error> errorHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IAdminClient, Error> | errorHandler |
Returns
Type | Description |
---|---|
AdminClientBuilder |
Remarks
Executes on the poll thread (a background thread managed by the admin client).
SetLogHandler(Action<IAdminClient, LogMessage>)
Set the handler to call when there is information available to be logged. If not specified, a default callback that writes to stderr will be used.
Declaration
public AdminClientBuilder SetLogHandler(Action<IAdminClient, LogMessage> logHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IAdminClient, LogMessage> | logHandler |
Returns
Type | Description |
---|---|
AdminClientBuilder |
Remarks
By default not many log messages are generated.
For more verbose logging, specify one or more debug contexts using the 'debug' configuration property.
Warning: Log handlers are called spontaneously from internal librdkafka threads and the application must not call any Confluent.Kafka APIs from within a log handler or perform any prolonged operations.
SetOAuthBearerTokenRefreshHandler(Action<IProducer<Null, Null>, String>)
Set SASL/OAUTHBEARER token refresh callback in provided conf object. The SASL/OAUTHBEARER token refresh callback is triggered via IAdminClient's admin methods (or any of its overloads) whenever OAUTHBEARER is the SASL mechanism and a token needs to be retrieved, typically based on the configuration defined in sasl.oauthbearer.config. The callback should invoke OAuthBearerSetToken(IClient, String, Int64, String, IDictionary<String, String>) or OAuthBearerSetTokenFailure(IClient, String) to indicate success or failure, respectively.
An unsecured JWT refresh handler is provided by librdkafka for development and testing purposes, it is enabled by setting the enable.sasl.oauthbearer.unsecure.jwt property to true and is mutually exclusive to using a refresh callback.
Declaration
public AdminClientBuilder SetOAuthBearerTokenRefreshHandler(Action<IProducer<Null, Null>, string> oAuthBearerTokenRefreshHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IProducer<Null, Null>, System.String> | oAuthBearerTokenRefreshHandler | the callback to set; callback function arguments: IProducer - instance of the admin client's inner producer instance which should be used to set token or token failure string - Value of configuration property sasl.oauthbearer.config |
Returns
Type | Description |
---|---|
AdminClientBuilder |
SetStatisticsHandler(Action<IAdminClient, String>)
Set the handler to call on statistics events. Statistics are provided as a JSON formatted string as defined here: https://github.com/edenhill/librdkafka/blob/master/STATISTICS.md
Declaration
public AdminClientBuilder SetStatisticsHandler(Action<IAdminClient, string> statisticsHandler)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IAdminClient, System.String> | statisticsHandler |
Returns
Type | Description |
---|---|
AdminClientBuilder |
Remarks
You can enable statistics by setting the statistics interval using the statistics.interval.ms configuration parameter (disabled by default).
Executes on the poll thread (a background thread managed by the admin client).