Table of Contents

Class KafkaClientConfigurationBuilder<TConfig, TConfluentConfig, TBuilder>

Namespace
Silverback.Messaging.Configuration.Kafka
Assembly
Silverback.Integration.Kafka.dll

The base class for all Kafka client configuration builders.

public abstract class KafkaClientConfigurationBuilder<TConfig, TConfluentConfig, TBuilder> where TConfig : KafkaClientConfiguration<TConfluentConfig>, new() where TConfluentConfig : ClientConfig, new() where TBuilder : KafkaClientConfigurationBuilder<TConfig, TConfluentConfig, TBuilder>

Type Parameters

TConfig

The type of the configuration being built.

TConfluentConfig

The type of the wrapped Confluent.Kafka.ClientConfig.

TBuilder

The actual builder type.

Inheritance
KafkaClientConfigurationBuilder<TConfig, TConfluentConfig, TBuilder>
Derived
Inherited Members

Constructors

KafkaClientConfigurationBuilder()

protected KafkaClientConfigurationBuilder()

Properties

Config

Gets the configuration being built.

protected TConfig Config { get; }

Property Value

TConfig

This

Gets this instance.

protected abstract TBuilder This { get; }

Property Value

TBuilder

Remarks

This is necessary to work around casting in the base classes.

Methods

AllowAutoCreateTopics()

Allow automatic topic creation on the broker when subscribing to or assigning non-existent topics. The broker must also be configured with auto.create.topics.enable=true for this configuration to take effect. Note: The default value (false) is different from the Java consumer (true). Requires broker version >= 0.11.0.0, for older broker versions only the broker configuration applies.

public TBuilder AllowAutoCreateTopics()

Returns

TBuilder

The builder so that additional calls can be chained.

BuildCore()

Builds the configuration.

protected virtual TConfig BuildCore()

Returns

TConfig

The configuration.

DisableApiVersionRequest()

Disables the API versions requests and uses the fallback version specified in BrokerVersionFallback.

public TBuilder DisableApiVersionRequest()

Returns

TBuilder

The builder so that additional calls can be chained.

DisableMetricsPush()

Disables pushing of client metrics to the cluster.

public TBuilder DisableMetricsPush()

Returns

TBuilder

The builder so that additional calls can be chained.

DisableSaslOauthbearerUnsecureJwt()

Disables the builtin unsecure JWT OAUTHBEARER token handler. This builtin handler should only be used for development or testing, and not in production.

public TBuilder DisableSaslOauthbearerUnsecureJwt()

Returns

TBuilder

The builder so that additional calls can be chained.

DisableSocketKeepalive()

Disables the TCP keep-alive (SO_KEEPALIVE) on the broker sockets.

public TBuilder DisableSocketKeepalive()

Returns

TBuilder

The builder so that additional calls can be chained.

DisableSocketNagle()

Disables the Nagle's algorithm (TCP_NODELAY) on the broker sockets.

public TBuilder DisableSocketNagle()

Returns

TBuilder

The builder so that additional calls can be chained.

DisableSparseTopicMetadataRefresh()

Disables sparse topic metadata requests.

public TBuilder DisableSparseTopicMetadataRefresh()

Returns

TBuilder

The builder so that additional calls can be chained.

DisableSslCertificateVerification()

Disables the SSL certificate validation.

public TBuilder DisableSslCertificateVerification()

Returns

TBuilder

The builder so that additional calls can be chained.

DisallowAutoCreateTopics()

Disallow automatic topic creation on the broker when subscribing to or assigning non-existent topics.

public TBuilder DisallowAutoCreateTopics()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableApiVersionRequest()

Enables the API versions requests to adjust the functionality according to the available protocol features. If the request fails, the fallback version specified in BrokerVersionFallback will be used.

public TBuilder EnableApiVersionRequest()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableMetricsPush()

Enables pushing of client metrics to the cluster, if the cluster has a client metrics subscription which matches this client.

public TBuilder EnableMetricsPush()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableSaslOauthbearerUnsecureJwt()

Enables the builtin unsecure JWT OAUTHBEARER token handler. This builtin handler should only be used for development or testing, and not in production.

public TBuilder EnableSaslOauthbearerUnsecureJwt()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableSocketKeepalive()

Enables the TCP keep-alive (SO_KEEPALIVE) on the broker sockets.

public TBuilder EnableSocketKeepalive()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableSocketNagle()

Enables the Nagle's algorithm (TCP_NODELAY) on the broker sockets.

public TBuilder EnableSocketNagle()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableSparseTopicMetadataRefresh()

Enables Generates less topic metadata requests (consuming less network bandwidth).

public TBuilder EnableSparseTopicMetadataRefresh()

Returns

TBuilder

The builder so that additional calls can be chained.

EnableSslCertificateVerification()

Enables the SSL certificate validation.

public TBuilder EnableSslCertificateVerification()

Returns

TBuilder

The builder so that additional calls can be chained.

WithAcks(Acks?)

Sets the number of acknowledgements that the leader broker must receive from the in-sync replicas before responding to the request: Confluent.Kafka.Acks.None (no response/ack is sent to the client), Confluent.Kafka.Acks.Leader (the leader will write the record to its local log but will respond without awaiting full acknowledgement from all followers, or Confluent.Kafka.Acks.All (the broker will block until the message is committed by all in-sync replicas. If there are less than min.insync.replicas (broker configuration) in the in-sync replicas set the produce request will fail.

public TBuilder WithAcks(Acks? acks)

Parameters

acks Acks?

The number of acknowledgements that the leader broker must receive from the in-sync replicas.

Returns

TBuilder

The builder so that additional calls can be chained.

WithApiVersionFallbackMs(int?)

Sets how long the BrokerVersionFallback is used in the case the API version request fails.

public TBuilder WithApiVersionFallbackMs(int? apiVersionFallbackMs)

Parameters

apiVersionFallbackMs int?

How long the fallback API version must be used.

Returns

TBuilder

The builder so that additional calls can be chained.

WithApiVersionRequestTimeoutMs(int?)

Sets the timeout (in milliseconds) for the broker API version requests.

public TBuilder WithApiVersionRequestTimeoutMs(int? apiVersionRequestTimeoutMs)

Parameters

apiVersionRequestTimeoutMs int?

The timeout for the broker API version requests.

Returns

TBuilder

The builder so that additional calls can be chained.

WithBootstrapServers(string?)

Sets the comma-separated list of brokers (host or host:port).

public TBuilder WithBootstrapServers(string? bootstrapServers)

Parameters

bootstrapServers string

The comma-separated list of brokers.

Returns

TBuilder

The builder so that additional calls can be chained.

WithBrokerAddressFamily(BrokerAddressFamily?)

Sets the allowed broker IP address families.

public TBuilder WithBrokerAddressFamily(BrokerAddressFamily? brokerAddressFamily)

Parameters

brokerAddressFamily BrokerAddressFamily?

The allowed broker IP address families.

Returns

TBuilder

The builder so that additional calls can be chained.

WithBrokerAddressTtl(int?)

Sets the duration in milliseconds of the cache of the broker address resolving results.

public TBuilder WithBrokerAddressTtl(int? brokerAddressTtl)

Parameters

brokerAddressTtl int?

The duration in milliseconds of the cache of the broker address resolving results.

Returns

TBuilder

The builder so that additional calls can be chained.

WithBrokerVersionFallback(string?)

Sets the broker API version to be used when the API version request fails or it's disabled. Older broker versions (before 0.10.0) don't support the API version request. Valid values are: 0.9.0, 0.8.2, 0.8.1, 0.8.0. Any other value >= 0.10, such as 0.10.2.1, enables the ApiVersionRequest.

public TBuilder WithBrokerVersionFallback(string? brokerVersionFallback)

Parameters

brokerVersionFallback string

The broker API version to be used as fallback.

Returns

TBuilder

The builder so that additional calls can be chained.

WithCancellationDelayMaxMs(int)

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

public TBuilder WithCancellationDelayMaxMs(int cancellationDelayMaxMs)

Parameters

cancellationDelayMaxMs int

The maximum time (in milliseconds) before a cancellation request is acted on.

Returns

TBuilder

The builder so that additional calls can be chained.

WithClientDnsLookup(ClientDnsLookup?)

Sets a value indicating how the client uses DNS lookups. By default, when the lookup returns multiple IP addresses for a hostname, they will all be attempted for connection before the connection is considered failed. This applies to both bootstrap and advertised servers. If the value is set to Confluent.Kafka.ClientDnsLookup.ResolveCanonicalBootstrapServersOnly, each entry will be resolved and expanded into a list of canonical names. Warning: Confluent.Kafka.ClientDnsLookup.ResolveCanonicalBootstrapServersOnly must only be used with Confluent.Kafka.SaslMechanism.Gssapi (Kerberos), as it's the only purpose of this configuration value. Note: Default here is different from the Java client's default behavior, which connects only to the first IP address returned for a hostname.

public TBuilder WithClientDnsLookup(ClientDnsLookup? clientDnsLookup)

Parameters

clientDnsLookup ClientDnsLookup?

A value indicating how the client uses DNS lookups.

Returns

TBuilder

The builder so that additional calls can be chained.

WithClientId(string?)

Sets the client identifier.

public TBuilder WithClientId(string? clientId)

Parameters

clientId string

The client identifier.

Returns

TBuilder

The builder so that additional calls can be chained.

WithClientRack(string?)

Sets the rack identifier for this client. This can be any string value which indicates where this client is physically located.

public TBuilder WithClientRack(string? clientRack)

Parameters

clientRack string

The rack identifier for this client.

Returns

TBuilder

The builder so that additional calls can be chained.

WithConnectionsMaxIdleMs(int?)

Sets the maximum time of inactivity (in milliseconds) before closing the broker connections. Disable with 0. If this property is left at its default value some heuristics are performed to determine a suitable default value.

public TBuilder WithConnectionsMaxIdleMs(int? connectionsMaxIdleMs)

Parameters

connectionsMaxIdleMs int?

The maximum time of inactivity.

Returns

TBuilder

The builder so that additional calls can be chained.

WithDebug(string?)

Sets a comma-separated list of debug contexts to enable. Detailed producer debugging: broker,topic,msg. Detailed consumer debugging: consumer,cgrp,topic,fetch.

public TBuilder WithDebug(string? debug)

Parameters

debug string

The comma-separated list of debug contexts to enable.

Returns

TBuilder

The builder so that additional calls can be chained.

WithHttpsCaLocation(string?)

Sets the file or directory path to CA certificate(s) for verifying HTTPS endpoints, such as sasl.oauthbearer.token.endpoint.url used for OAUTHBEARER/OIDC authentication. Mutually exclusive with HttpsCaPem. Defaults: On Windows the system's CA certificates are automatically looked up in the Windows Root certificate store. On Mac OSX this configuration defaults to probe. It is recommended to install openssl using Homebrew to provide CA certificates. On Linux install the distribution's ca-certificates package. If OpenSSL is statically linked or https.ca.location is set to probe a list of standard paths will be probed and the first one found will be used as the default CA certificate location path. If OpenSSL is dynamically linked the OpenSSL library's default path will be used (see OPENSSLDIR in openssl version -a).

public TBuilder WithHttpsCaLocation(string? httpsCaLocation)

Parameters

httpsCaLocation string

The file or directory path to CA certificate(s) for verifying HTTPS endpoints, such as sasl.oauthbearer.token.endpoint.url used for OAUTHBEARER/OIDC authentication.

Returns

TBuilder

The builder so that additional calls can be chained.

WithHttpsCaPem(string?)

Sets the CA certificate string (in PEM format) for verifying HTTPS endpoints. Mutually exclusive with HttpsCaLocation.

public TBuilder WithHttpsCaPem(string? httpsCaPem)

Parameters

httpsCaPem string

The CA certificate string (in PEM format).

Returns

TBuilder

The builder so that additional calls can be chained.

WithMaxInFlight(int?)

Sets the maximum number of in-flight requests per broker connection. This is a generic property applied to all broker communication; however, it is primarily relevant to produce requests. In particular, note that other mechanisms limit the number of outstanding consumer fetch requests per broker to one.

public TBuilder WithMaxInFlight(int? maxInFlight)

Parameters

maxInFlight int?

The maximum number of in-flight requests per broker connection.

Returns

TBuilder

The builder so that additional calls can be chained.

WithMessageCopyMaxBytes(int?)

Sets the maximum size for a message to be copied into the buffer. Messages larger than this will be passed by reference (zero-copy) at the expense of larger iovecs.

public TBuilder WithMessageCopyMaxBytes(int? messageCopyMaxBytes)

Parameters

messageCopyMaxBytes int?

The maximum size for a message to be copied into the buffer.

Returns

TBuilder

The builder so that additional calls can be chained.

WithMessageMaxBytes(int?)

Sets the maximum message size.

public TBuilder WithMessageMaxBytes(int? messageMaxBytes)

Parameters

messageMaxBytes int?

The maximum message size.

Returns

TBuilder

The builder so that additional calls can be chained.

WithMetadataMaxAgeMs(int?)

Sets the metadata cache max age (in milliseconds). Defaults to TopicMetadataRefreshIntervalMs.

public TBuilder WithMetadataMaxAgeMs(int? metadataMaxAgeMs)

Parameters

metadataMaxAgeMs int?

The metadata cache max age.

Returns

TBuilder

The builder so that additional calls can be chained.

WithMetadataRecoveryRebootstrapTriggerMs(int?)

Sets the metadata recovery rebootstrap trigger interval (ms). When using Confluent.Kafka.MetadataRecoveryStrategy.Rebootstrap, if the client is unable to get metadata from any of the known brokers for the specified interval, the client repeats the bootstrap process using the configured bootstrap.servers and brokers added through rd_kafka_brokers_add(). Default: 300000 (5 minutes).

public TBuilder WithMetadataRecoveryRebootstrapTriggerMs(int? metadataRecoveryRebootstrapTriggerMs)

Parameters

metadataRecoveryRebootstrapTriggerMs int?

The metadata recovery rebootstrap trigger interval (ms).

Returns

TBuilder

The builder so that additional calls can be chained.

WithMetadataRecoveryStrategy(MetadataRecoveryStrategy?)

Sets the metadata recovery strategy. If set to Confluent.Kafka.MetadataRecoveryStrategy.None the client doesn't re-bootstrap. If set to Confluent.Kafka.MetadataRecoveryStrategy.Rebootstrap the client repeats the bootstrap process using the configured bootstrap.servers and brokers added through rd_kafka_brokers_add(). Rebootstrapping is useful when a client talks to brokers so infrequently that the broker set may change entirely before the client refreshes metadata. Metadata recovery is triggered when all last-known brokers appear unavailable simultaneously, when the client cannot refresh metadata within the configured rebootstrap trigger interval, or when requested in a metadata response.

public TBuilder WithMetadataRecoveryStrategy(MetadataRecoveryStrategy? metadataRecoveryStrategy)

Parameters

metadataRecoveryStrategy MetadataRecoveryStrategy?

The metadata recovery strategy.

Returns

TBuilder

The builder so that additional calls can be chained.

WithPluginLibraryPaths(string?)

Sets the list of plugin libraries to load (; separated). The library search path is platform dependent. If no filename extension is specified the platform-specific extension (such as .dll or .so) will be appended automatically.

public TBuilder WithPluginLibraryPaths(string? pluginLibraryPaths)

Parameters

pluginLibraryPaths string

The list of plugin libraries to load (; separated).

Returns

TBuilder

The builder so that additional calls can be chained.

WithReceiveMessageMaxBytes(int?)

Sets the maximum response message size. This serves as a safety precaution to avoid memory exhaustion in case of protocol hickups. This value must be at least FetchMaxBytes + 512 to allow for protocol overhead. The value is adjusted automatically unless the configuration property is explicitly set.

public TBuilder WithReceiveMessageMaxBytes(int? receiveMessageMaxBytes)

Parameters

receiveMessageMaxBytes int?

The maximum response message size.

Returns

TBuilder

The builder so that additional calls can be chained.

WithReconnectBackoffMaxMs(int?)

Sets the maximum time (in milliseconds) to wait before reconnecting to a broker after the connection has been closed.

public TBuilder WithReconnectBackoffMaxMs(int? reconnectBackoffMaxMs)

Parameters

reconnectBackoffMaxMs int?

The maximum time to wait before reconnecting to a broker.

Returns

TBuilder

The builder so that additional calls can be chained.

WithReconnectBackoffMs(int?)

Sets the initial time (in milliseconds) to wait before reconnecting to a broker after the connection has been closed. The time is increased exponentially until ReconnectBackoffMaxMs is reached. -25% to +50% jitter is applied to each reconnect backoff. A value of 0 disables the backoff and reconnects immediately.

public TBuilder WithReconnectBackoffMs(int? reconnectBackoffMs)

Parameters

reconnectBackoffMs int?

The initial time to wait before reconnecting to a broker.

Returns

TBuilder

The builder so that additional calls can be chained.

WithRetryBackoffMaxMs(int?)

Sets the maximum backoff time in milliseconds before retrying a protocol request, this is the maximum backoff allowed for exponentially backed off requests.

public TBuilder WithRetryBackoffMaxMs(int? retryBackoffMaxMs)

Parameters

retryBackoffMaxMs int?

The maximum backoff time in milliseconds before retrying a protocol request.

Returns

TBuilder

The builder so that additional calls can be chained.

WithRetryBackoffMs(int?)

Sets the backoff time in milliseconds before retrying a protocol request, this is the first backoff time, and will be backed off exponentially until number of retries is exhausted, and it's capped with RetryBackoffMaxMs.

public TBuilder WithRetryBackoffMs(int? retryBackoffMs)

Parameters

retryBackoffMs int?

The backoff time in milliseconds before retrying a protocol request.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslKerberosKeytab(string?)

Sets the path to the Kerberos keytab file. This configuration property is only used as a variable in SaslKerberosKinitCmd as ... -t "%{sasl.kerberos.keytab}".

public TBuilder WithSaslKerberosKeytab(string? saslKerberosKeytab)

Parameters

saslKerberosKeytab string

The path to the Kerberos keytab file.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslKerberosKinitCmd(string?)

Sets the shell command to be used to refresh or acquire the client's Kerberos ticket. This command is executed on client creation and every SaslKerberosMinTimeBeforeRelogin (0=disable).

public TBuilder WithSaslKerberosKinitCmd(string? saslKerberosKinitCmd)

Parameters

saslKerberosKinitCmd string

The shell command to be used to refresh or acquire the client's Kerberos ticket.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslKerberosMinTimeBeforeRelogin(int?)

Sets the minimum time in milliseconds between each key refresh attempts. Disable automatic key refresh by setting this property to 0.

public TBuilder WithSaslKerberosMinTimeBeforeRelogin(int? saslKerberosMinTimeBeforeRelogin)

Parameters

saslKerberosMinTimeBeforeRelogin int?

The minimum time in milliseconds between each key refresh attempts.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslKerberosPrincipal(string?)

Sets the client's Kerberos principal name. (Not supported on Windows, will use the logon user's principal).

public TBuilder WithSaslKerberosPrincipal(string? saslKerberosPrincipal)

Parameters

saslKerberosPrincipal string

The client's Kerberos principal name. (Not supported on Windows, will use the logon user's principal).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslKerberosServiceName(string?)

Sets the Kerberos principal name that Kafka runs as, not including /hostname@REALM.

public TBuilder WithSaslKerberosServiceName(string? saslKerberosServiceName)

Parameters

saslKerberosServiceName string

The Kerberos principal name that Kafka runs as.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslMechanism(SaslMechanism?)

Sets the SASL mechanism to use for authentication. Supported: GSSAPI, PLAIN, SCRAM-SHA-256, SCRAM-SHA-512.

public TBuilder WithSaslMechanism(SaslMechanism? saslMechanism)

Parameters

saslMechanism SaslMechanism?

The SASL mechanism.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionAlgorithm(SaslOauthbearerAssertionAlgorithm?)

Sets the algorithm the client should use to sign the assertion sent to the identity provider and in the OAuth alg header in the JWT assertion.

public TBuilder WithSaslOauthbearerAssertionAlgorithm(SaslOauthbearerAssertionAlgorithm? saslOauthbearerAssertionAlgorithm)

Parameters

saslOauthbearerAssertionAlgorithm SaslOauthbearerAssertionAlgorithm?

The algorithm the client should use to sign the assertion sent to the identity provider and in the OAuth alg header in the JWT assertion.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionClaimAud(string?)

Sets the JWT audience claim. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionClaimAud(string? saslOauthbearerAssertionClaimAud)

Parameters

saslOauthbearerAssertionClaimAud string

The JWT audience claim.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionClaimExpSeconds(int?)

Sets the assertion expiration time in seconds. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionClaimExpSeconds(int? saslOauthbearerAssertionClaimExpSeconds)

Parameters

saslOauthbearerAssertionClaimExpSeconds int?

The assertion expiration time in seconds.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionClaimIss(string?)

Sets the JWT issuer claim. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionClaimIss(string? saslOauthbearerAssertionClaimIss)

Parameters

saslOauthbearerAssertionClaimIss string

The JWT issuer claim.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionClaimJtiInclude(bool?)

Sets the JWT ID claim. When set to true, a random UUID is generated. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionClaimJtiInclude(bool? saslOauthbearerAssertionClaimJtiInclude)

Parameters

saslOauthbearerAssertionClaimJtiInclude bool?

The JWT ID claim.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionClaimNbfSeconds(int?)

Sets the assertion not before time in seconds. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionClaimNbfSeconds(int? saslOauthbearerAssertionClaimNbfSeconds)

Parameters

saslOauthbearerAssertionClaimNbfSeconds int?

The assertion not before time in seconds.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionClaimSub(string?)

Sets the JWT subject claim. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionClaimSub(string? saslOauthbearerAssertionClaimSub)

Parameters

saslOauthbearerAssertionClaimSub string

The JWT subject claim.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionFile(string?)

Sets the path to the assertion file. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionFile(string? saslOauthbearerAssertionFile)

Parameters

saslOauthbearerAssertionFile string

The path to the assertion file.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionJwtTemplateFile(string?)

Sets the path to the JWT template file. Only used when sasl.oauthbearer.method is set to "oidc" and JWT assertion is needed.

public TBuilder WithSaslOauthbearerAssertionJwtTemplateFile(string? saslOauthbearerAssertionJwtTemplateFile)

Parameters

saslOauthbearerAssertionJwtTemplateFile string

The path to the JWT template file.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionPrivateKeyFile(string?)

Sets the path to the client's private key (PEM) used for authentication when using the JWT assertion.

public TBuilder WithSaslOauthbearerAssertionPrivateKeyFile(string? saslOauthbearerAssertionPrivateKeyFile)

Parameters

saslOauthbearerAssertionPrivateKeyFile string

The path to the client's private key (PEM) used for authentication when using the JWT assertion.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionPrivateKeyPassphrase(string?)

Sets the private key passphrase for sasl.oauthbearer.assertion.private.key.file or sasl.oauthbearer.assertion.private.key.pem.

public TBuilder WithSaslOauthbearerAssertionPrivateKeyPassphrase(string? saslOauthbearerAssertionPrivateKeyPassphrase)

Parameters

saslOauthbearerAssertionPrivateKeyPassphrase string

The private key passphrase for sasl.oauthbearer.assertion.private.key.file or sasl.oauthbearer.assertion.private.key.pem.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerAssertionPrivateKeyPem(string?)

Sets the client's private key (PEM) used for authentication when using the JWT assertion.

public TBuilder WithSaslOauthbearerAssertionPrivateKeyPem(string? saslOauthbearerAssertionPrivateKeyPem)

Parameters

saslOauthbearerAssertionPrivateKeyPem string

The client's private key (PEM) used for authentication when using the JWT assertion.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerClientId(string?)

Sets the public identifier for the application. Must be unique across all clients that the authorization server handles. Only used when SaslOauthbearerMethod is set to Confluent.Kafka.SaslOauthbearerMethod.Oidc.

public TBuilder WithSaslOauthbearerClientId(string? saslOauthbearerClientId)

Parameters

saslOauthbearerClientId string

The public identifier for the application.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerClientSecret(string?)

Sets the client secret only known to the application and the authorization server. This should be a sufficiently random string that is not guessable. Only used when SaslOauthbearerMethod is set to Confluent.Kafka.SaslOauthbearerMethod.Oidc.

public TBuilder WithSaslOauthbearerClientSecret(string? saslOauthbearerClientSecret)

Parameters

saslOauthbearerClientSecret string

The client secret only known to the application and the authorization server.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerConfig(string?)

Sets the SASL/OAUTHBEARER configuration. The format is implementation-dependent and must be parsed accordingly. The default unsecured token implementation (see https://tools.ietf.org/html/rfc7515#appendix-A.5) recognizes space-separated name=value pairs with valid names including principalClaimName, principal, scopeClaimName, scope, and lifeSeconds. The default value for principalClaimName is "sub", the default value for scopeClaimName is "scope", and the default value for lifeSeconds is 3600. The scope value is CSV format with the default value being no/empty scope. For example: principalClaimName=azp principal=admin scopeClaimName=roles scope=role1,role2 lifeSeconds=600. In addition, SASL extensions can be communicated to the broker via extension_NAME=value. For example: principal=admin extension_traceId=123.

public TBuilder WithSaslOauthbearerConfig(string? saslOauthbearerConfig)

Parameters

saslOauthbearerConfig string

The SASL/OAUTHBEARER configuration.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerExtensions(string?)

Sets the additional information to be provided to the broker as a comma-separated list of key=value pairs (e.g. supportFeatureX=true,organizationId=sales-emea). Only used when SaslOauthbearerMethod is set to Confluent.Kafka.SaslOauthbearerMethod.Oidc.

public TBuilder WithSaslOauthbearerExtensions(string? saslOauthbearerExtensions)

Parameters

saslOauthbearerExtensions string

The additional information to be provided to the broker as a comma-separated list of key=value pairs.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerGrantType(SaslOauthbearerGrantType?)

Sets the OAuth grant type to use when communicating with the identity provider.

public TBuilder WithSaslOauthbearerGrantType(SaslOauthbearerGrantType? saslOauthbearerGrantType)

Parameters

saslOauthbearerGrantType SaslOauthbearerGrantType?

The OAuth grant type to use when communicating with the identity provider.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerMetadataAuthenticationType(SaslOauthbearerMetadataAuthenticationType?)

Sets the type of metadata-based authentication to use for OAUTHBEARER/OIDC azure_imds authenticates using the Azure IMDS endpoint. Sets a default value for sasl.oauthbearer.token.endpoint.url if missing. Configuration values specific of chosen authentication type can be passed through sasl.oauthbearer.config.

public TBuilder WithSaslOauthbearerMetadataAuthenticationType(SaslOauthbearerMetadataAuthenticationType? saslOauthbearerMetadataAuthenticationType)

Parameters

saslOauthbearerMetadataAuthenticationType SaslOauthbearerMetadataAuthenticationType?

The type of metadata-based authentication to use for OAUTHBEARER/OIDC.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerMethod(SaslOauthbearerMethod?)

Sets the login method to be used. If set to Confluent.Kafka.SaslOauthbearerMethod.Oidc, the following properties must also be be specified: SaslOauthbearerClientId, SaslOauthbearerClientSecret, and SaslOauthbearerTokenEndpointUrl.

public TBuilder WithSaslOauthbearerMethod(SaslOauthbearerMethod? saslOauthbearerMethod)

Parameters

saslOauthbearerMethod SaslOauthbearerMethod?

The login method to be used.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerScope(string?)

Sets the scope of the access request to the broker. Only used when SaslOauthbearerMethod is set to Confluent.Kafka.SaslOauthbearerMethod.Oidc.

public TBuilder WithSaslOauthbearerScope(string? saslOauthbearerScope)

Parameters

saslOauthbearerScope string

The scope of the access request to the broker.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslOauthbearerTokenEndpointUrl(string?)

Sets the OAuth/OIDC issuer token endpoint HTTP(S) URI used to retrieve the token. Only used when SaslOauthbearerMethod is set to Confluent.Kafka.SaslOauthbearerMethod.Oidc.

public TBuilder WithSaslOauthbearerTokenEndpointUrl(string? saslOauthbearerTokenEndpointUrl)

Parameters

saslOauthbearerTokenEndpointUrl string

The OAuth/OIDC issuer token endpoint HTTP(S) URI used to retrieve the token.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslPassword(string?)

Sets the SASL password to use with the PLAIN and SASL-SCRAM-.. mechanisms.

public TBuilder WithSaslPassword(string? saslPassword)

Parameters

saslPassword string

The SASL password to use with the PLAIN and SASL-SCRAM-.. mechanisms.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSaslUsername(string?)

Sets the SASL username to use with the PLAIN and SASL-SCRAM-.. mechanisms.

public TBuilder WithSaslUsername(string? saslUsername)

Parameters

saslUsername string

The SASL username to use with the PLAIN and SASL-SCRAM-.. mechanisms.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSecurityProtocol(SecurityProtocol?)

Sets the protocol to be used to communicate with the brokers.

public TBuilder WithSecurityProtocol(SecurityProtocol? securityProtocol)

Parameters

securityProtocol SecurityProtocol?

The protocol to be used to communicate with the brokers.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSocketConnectionSetupTimeoutMs(int?)

Sets the maximum time (in milliseconds) allowed for the setup of the broker connection (TCP connection setup and SSL/SASL handshake). The connection to the broker will be closed and retried, if the timeout elapses before it is fully functional.

public TBuilder WithSocketConnectionSetupTimeoutMs(int? socketConnectionSetupTimeoutMs)

Parameters

socketConnectionSetupTimeoutMs int?

The maximum time allowed for the setup of the broker connection.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSocketMaxFails(int?)

Sets the maximum number of send failures (e.g. timed out requests) before disconnecting. Disable with 0.
Warning: It is highly recommended to leave this setting at its default value of 1 to avoid the client and broker to become desynchronized in case of request timeouts.
Note: The connection is automatically re-established.

public TBuilder WithSocketMaxFails(int? socketMaxFails)

Parameters

socketMaxFails int?

The maximum number of send failures before disconnecting.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSocketReceiveBufferBytes(int?)

Sets the socket receive buffer size. The system default is used if 0.

public TBuilder WithSocketReceiveBufferBytes(int? socketReceiveBufferBytes)

Parameters

socketReceiveBufferBytes int?

The socket receive buffer size.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSocketSendBufferBytes(int?)

Sets the socket send buffer size. The system default is used if 0.

public TBuilder WithSocketSendBufferBytes(int? socketSendBufferBytes)

Parameters

socketSendBufferBytes int?

The socket send buffer size.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSocketTimeoutMs(int?)

Sets the default timeout (in milliseconds) for network requests.

public TBuilder WithSocketTimeoutMs(int? socketTimeoutMs)

Parameters

socketTimeoutMs int?

The default timeout for network requests.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCaCertificateStores(string?)

Sets a comma-separated list of Windows certificate stores to load CA certificates from. The certificates will be loaded in the same order as stores are specified. If no certificates can be loaded from any of the specified stores an error is logged and the OpenSSL library's default CA location is used instead. Store names are typically one or more of: MY, Root, Trust, CA.

public TBuilder WithSslCaCertificateStores(string? sslCaCertificateStores)

Parameters

sslCaCertificateStores string

A comma-separated list of Windows certificate stores to load CA certificates from.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCaLocation(string?)

Sets the file or directory path to the CA certificate(s) for verifying the broker's key. Defaults: On Windows the system's CA certificates are automatically looked up in the Windows Root certificate store. On Mac OSX this configuration defaults to probe. It is recommended to install openssl using Homebrew, to provide CA certificates. On Linux install the distribution's ca-certificates package. If OpenSSL is statically linked or SslCaLocation is set to probe a list of standard paths will be probed and the first one found will be used as the default CA certificate location path. If OpenSSL is dynamically linked the OpenSSL library's default path will be used (see OPENSSLDIR in openssl version -a).

public TBuilder WithSslCaLocation(string? sslCaLocation)

Parameters

sslCaLocation string

The file or directory path to the CA certificate(s) for verifying the broker's key.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCaPem(string?)

Sets the CA certificate string (in PEM format) for verifying the broker's key.

public TBuilder WithSslCaPem(string? sslCaPem)

Parameters

sslCaPem string

The CA certificate string (in PEM format).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCertificateLocation(string?)

Sets the path to the client's public key (PEM) used for the authentication.

public TBuilder WithSslCertificateLocation(string? sslCertificateLocation)

Parameters

sslCertificateLocation string

The path to the client's public key (PEM).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCertificatePem(string?)

Sets the client's public key string (in PEM format) used for the authentication.

public TBuilder WithSslCertificatePem(string? sslCertificatePem)

Parameters

sslCertificatePem string

The client's public key string (in PEM format).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCipherSuites(string?)

Sets the SSL cipher suites.

public TBuilder WithSslCipherSuites(string? sslCipherSuites)

Parameters

sslCipherSuites string

The SSL cipher suites.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCrlLocation(string?)

Sets the path to the certificate revocation list (CRL) for verifying broker's certificate validity.

public TBuilder WithSslCrlLocation(string? sslCrlLocation)

Parameters

sslCrlLocation string

The path to the certificate revocation list (CRL).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslCurvesList(string?)

Sets the supported SSL curves.

public TBuilder WithSslCurvesList(string? sslCurvesList)

Parameters

sslCurvesList string

The supported SSL curves.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslEndpointIdentificationAlgorithm(SslEndpointIdentificationAlgorithm?)

Sets the endpoint identification algorithm to be used to validate the broker hostname using the certificate. OpenSSL >= 1.0.2 required.

public TBuilder WithSslEndpointIdentificationAlgorithm(SslEndpointIdentificationAlgorithm? sslEndpointIdentificationAlgorithm)

Parameters

sslEndpointIdentificationAlgorithm SslEndpointIdentificationAlgorithm?

The endpoint identification algorithm to be used to validate the broker hostname.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslEngineId(string?)

Sets the OpenSSL engine id (the name used for loading engine).

public TBuilder WithSslEngineId(string? sslEngineId)

Parameters

sslEngineId string

The OpenSSL engine id.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslEngineLocation(string?)

Sets the path to the OpenSSL engine library. OpenSSL >= 1.1.0 required.

public TBuilder WithSslEngineLocation(string? sslEngineLocation)

Parameters

sslEngineLocation string

The path to the OpenSSL engine library.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslKeyLocation(string?)

Sets the path to the client's private key (PEM) used for the authentication.

public TBuilder WithSslKeyLocation(string? sslKeyLocation)

Parameters

sslKeyLocation string

The path to the client's private key (PEM).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslKeyPassword(string?)

Sets the private key passphrase.

public TBuilder WithSslKeyPassword(string? sslKeyPassword)

Parameters

sslKeyPassword string

The private key passphrase.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslKeyPem(string?)

Sets the client's private key string (in PEM format) used for the authentication.

public TBuilder WithSslKeyPem(string? sslKeyPem)

Parameters

sslKeyPem string

The client's private key string (in PEM format).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslKeystoreLocation(string?)

Sets the path to the client's keystore (PKCS#12) used for the authentication.

public TBuilder WithSslKeystoreLocation(string? sslKeystoreLocation)

Parameters

sslKeystoreLocation string

The path to the client's keystore (PKCS#12).

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslKeystorePassword(string?)

Sets the client's keystore (PKCS#12) password.

public TBuilder WithSslKeystorePassword(string? sslKeystorePassword)

Parameters

sslKeystorePassword string

The client's keystore (PKCS#12) password.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslProviders(string?)

Sets the comma-separated list of OpenSSL 3.0.x implementation providers.

public TBuilder WithSslProviders(string? sslProviders)

Parameters

sslProviders string

The comma-separated list of OpenSSL 3.0.x implementation providers.

Returns

TBuilder

The builder so that additional calls can be chained.

WithSslSigalgsList(string?)

Sets the supported SSL signature algorithms.

public TBuilder WithSslSigalgsList(string? sslSigalgsList)

Parameters

sslSigalgsList string

The supported SSL signature algorithms.

Returns

TBuilder

The builder so that additional calls can be chained.

WithStatisticsIntervalMs(int?)

Sets the statistics emit interval (in milliseconds). The granularity is 1000ms. A value of 0 disables statistics.

public TBuilder WithStatisticsIntervalMs(int? statisticsIntervalMs)

Parameters

statisticsIntervalMs int?

The statistics emit interval.

Returns

TBuilder

The builder so that additional calls can be chained.

WithTopicBlacklist(string?)

Sets a comma-separated list of regular expressions for matching topic names that should be ignored in broker metadata information as if the topics did not exist.

public TBuilder WithTopicBlacklist(string? topicBlacklist)

Parameters

topicBlacklist string

The comma-separated list of regular expressions for the topic black list.

Returns

TBuilder

The builder so that additional calls can be chained.

WithTopicMetadataPropagationMaxMs(int?)

Sets the delay (in milliseconds) to be applied before marking a topic as non-existent. The maximum propagation time is calculated from the time the topic is first referenced in the client.

public TBuilder WithTopicMetadataPropagationMaxMs(int? topicMetadataPropagationMaxMs)

Parameters

topicMetadataPropagationMaxMs int?

The delay to be observed before marking a topic as non-existent.

Returns

TBuilder

The builder so that additional calls can be chained.

WithTopicMetadataRefreshFastIntervalMs(int?)

Sets the refresh interval (in milliseconds) to be applied instead of the TopicMetadataRefreshIntervalMs when a topic loses its leader and a new metadata request will be enqueued. This initial interval will be exponentially increased until the topic metadata has been refreshed. This is used to recover quickly from transitioning leader brokers.

public TBuilder WithTopicMetadataRefreshFastIntervalMs(int? topicMetadataRefreshFastIntervalMs)

Parameters

topicMetadataRefreshFastIntervalMs int?

The refresh interval.

Returns

TBuilder

The builder so that additional calls can be chained.

WithTopicMetadataRefreshIntervalMs(int?)

Sets the interval (in milliseconds) at which the topic and broker metadata is refreshed to proactively discover any new brokers, topics, partitions, or partition leader changes. Use -1 to disable the intervalled refresh (not recommended). If there are no locally referenced topics (no topic objects created, no messages produced, no subscription or no assignment), then only the broker list will be refreshed every interval but no more often than every 10s.

public TBuilder WithTopicMetadataRefreshIntervalMs(int? topicMetadataRefreshIntervalMs)

Parameters

topicMetadataRefreshIntervalMs int?

The interval at which the topic and broker metadata is refreshed.

Returns

TBuilder

The builder so that additional calls can be chained.