confluent-kafka-dotnet
Show / Hide Table of Contents

Class Config

Base functionality common to all configuration classes.

Inheritance
object
Config
ClientConfig
SerdeConfig
Implements
IEnumerable<KeyValuePair<string, string>>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Confluent.Kafka
Assembly: Confluent.Kafka.dll
Syntax
public class Config : IEnumerable<KeyValuePair<string, string>>, IEnumerable

Constructors

Config()

Initialize a new empty Config instance.

Declaration
public Config()

Config(Config)

Initialize a new Config instance based on an existing Config instance. This will change the values "in-place" i.e. operations on this class WILL modify the provided collection

Declaration
public Config(Config config)
Parameters
TypeNameDescription
Configconfig

Config(IDictionary<string, string>)

Initialize a new Config wrapping an existing key/value dictionary. This will change the values "in-place" i.e. operations on this class WILL modify the provided collection

Declaration
public Config(IDictionary<string, string> config)
Parameters
TypeNameDescription
IDictionary<string, string>config

Fields

properties

The configuration properties.

Declaration
protected IDictionary<string, string> properties
Field Value
TypeDescription
IDictionary<string, string>

Properties

CancellationDelayMaxMs

The maximum length of time (in milliseconds) before a cancellation request is acted on. Low values may result in measurably higher CPU usage.

default: 100 range: 1 <= dotnet.cancellation.delay.max.ms <= 10000 importance: low

Declaration
public int CancellationDelayMaxMs { set; }
Property Value
TypeDescription
int

Methods

Get(string)

Gets a configuration property value given a key. Returns null if the property has not been set.

Declaration
public string Get(string key)
Parameters
TypeNameDescription
stringkey

The configuration property to get.

Returns
TypeDescription
string

The configuration property value.

GetBool(string)

Gets a configuration property bool? value given a key.

Declaration
protected bool? GetBool(string key)
Parameters
TypeNameDescription
stringkey

The configuration property to get.

Returns
TypeDescription
bool?

The configuration property value.

GetDouble(string)

Gets a configuration property double? value given a key.

Declaration
protected double? GetDouble(string key)
Parameters
TypeNameDescription
stringkey

The configuration property to get.

Returns
TypeDescription
double?

The configuration property value.

GetEnum(Type, string)

Gets a configuration property enum value given a key.

Declaration
protected object GetEnum(Type type, string key)
Parameters
TypeNameDescription
Typetype

The enum type of the configuration property.

stringkey

The configuration property to get.

Returns
TypeDescription
object

The configuration property value.

GetEnumerator()

Returns an enumerator that iterates through the property collection.

Declaration
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
Returns
TypeDescription
IEnumerator<KeyValuePair<string, string>>

An enumerator that iterates through the property collection.

GetInt(string)

Gets a configuration property int? value given a key.

Declaration
protected int? GetInt(string key)
Parameters
TypeNameDescription
stringkey

The configuration property to get.

Returns
TypeDescription
int?

The configuration property value.

Set(string, string)

Set a configuration property using a string key / value pair.

Declaration
public void Set(string key, string val)
Parameters
TypeNameDescription
stringkey

The configuration property name.

stringval

The property value.

Remarks

Two scenarios where this is useful: 1. For setting librdkafka plugin config properties. 2. You are using a different version of librdkafka to the one provided as a dependency of the Confluent.Kafka package and the configuration properties have evolved.

SetObject(string, object)

Set a configuration property using a key / value pair (null checked).

Declaration
protected void SetObject(string name, object val)
Parameters
TypeNameDescription
stringname
objectval

Implements

IEnumerable<T>
IEnumerable
In this article