Class ClientExtensions
IClient extension methods
Inherited Members
Namespace: Confluent.Kafka
Assembly: Confluent.Kafka.dll
Syntax
public static class ClientExtensions
Methods
ClusterId(IClient, TimeSpan)
EXPERIMENTAL: subject to change or removal.
Gets the id of the Kafka cluster this client is connected to.
The cluster id is retrieved from the broker
metadata, so this call blocks until the
metadata has been received, or until
timeout elapses.
Declaration
public static string ClusterId(this IClient client, TimeSpan timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| IClient | client | the instance of a IClient |
| TimeSpan | timeout | The maximum period of time to block waiting for the cluster id. |
Returns
| Type | Description |
|---|---|
| string | The Kafka cluster id, or null if it could not
be retrieved within |
Remarks
Requires broker version >= 0.10.0.
OAuthBearerSetToken(IClient, string, long, string, IDictionary<string, string>)
Set SASL/OAUTHBEARER token and metadata.
The SASL/OAUTHBEARER token refresh callback or
event handler should invoke this method upon
success. The extension keys must not include
the reserved key "auth", and all extension
keys and values must conform to the required
format as per https://tools.ietf.org/html/rfc7628#section-3.1:
Declaration
public static void OAuthBearerSetToken(this IClient client, string tokenValue, long lifetimeMs, string principalName, IDictionary<string, string> extensions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IClient | client | the instance of a IClient |
| string | tokenValue | the mandatory token value to set, often (but not necessarily) a JWS compact serialization as per https://tools.ietf.org/html/rfc7515#section-3.1. |
| long | lifetimeMs | when the token expires, in terms of the number of milliseconds since the epoch. |
| string | principalName | the mandatory Kafka principal name associated with the token. |
| IDictionary<string, string> | extensions | optional SASL extensions dictionary, to be communicated to the broker as additional key-value pairs during the initial client response as per https://tools.ietf.org/html/rfc7628#section-3.1. |
See Also
OAuthBearerSetTokenFailure(IClient, string)
SASL/OAUTHBEARER token refresh failure indicator. The SASL/OAUTHBEARER token refresh callback or event handler should invoke this method upon failure.
Declaration
public static void OAuthBearerSetTokenFailure(this IClient client, string error)
Parameters
| Type | Name | Description |
|---|---|---|
| IClient | client | the instance of a IClient |
| string | error | mandatory human readable error reason for failing to acquire a token. |