Interface IClient
Defines methods common to all client types.
Inherited Members
Namespace: Confluent.Kafka
Assembly: cs.temp.dll.dll
Syntax
public interface IClient : IDisposable
Properties
Handle
An opaque reference to the underlying librdkafka client instance. This can be used to construct an AdminClient that utilizes the same underlying librdkafka client as this instance.
Declaration
Handle Handle { get; }
Property Value
Type | Description |
---|---|
Handle |
Name
Gets the name of this client instance.
Contains (but is not equal to) the client.id configuration parameter.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This name will be unique across all client instances in a given application which allows log messages to be associated with the corresponding instance.
Methods
AddBrokers(String)
Adds one or more brokers to the Client's list of initial bootstrap brokers.
Note: Additional brokers are discovered automatically as soon as the Client connects to any broker by querying the broker metadata. Calling this method is only required in some scenarios where the address of all brokers in the cluster changes.
Declaration
int AddBrokers(string brokers)
Parameters
Type | Name | Description |
---|---|---|
System.String | brokers | Comma-separated list of brokers in the same format as the bootstrap.server configuration parameter. |
Returns
Type | Description |
---|---|
System.Int32 | The number of brokers added. This value includes brokers that may have been specified a second time. |
Remarks
There is currently no API to remove existing configured, added or learnt brokers.
SetSaslCredentials(String, String)
SetSaslCredentials sets the SASL credentials used for this client. The new credentials will overwrite the old ones (which were set when creating client or by a previous call to SetSaslCredentials). The new credentials will be used the next time the client needs to authenticate to a broker. This method will not disconnect existing broker connections that were established with the old credentials. This method applies only to the SASL PLAIN and SCRAM mechanisms.
Declaration
void SetSaslCredentials(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | The username to set. |
System.String | password | The password to set. |