Class KafkaClientsConfigurationBuilder
Configures the Kafka producers and consumers building the KafkaProducerConfiguration and KafkaConsumerConfiguration.
Inherited Members
Namespace: Silverback.Messaging.Configuration.Kafka
Assembly: Silverback.Integration.Kafka.dll
Syntax
public class KafkaClientsConfigurationBuilder
Constructors
KafkaClientsConfigurationBuilder()
Configures the Kafka producers and consumers building the KafkaProducerConfiguration and KafkaConsumerConfiguration.
Declaration
public KafkaClientsConfigurationBuilder()
Methods
AddConsumer(Action<KafkaConsumerConfigurationBuilder>)
Adds a Kafka consumer.
Declaration
public KafkaClientsConfigurationBuilder AddConsumer(Action<KafkaConsumerConfigurationBuilder> configurationBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<KafkaConsumerConfigurationBuilder> | configurationBuilderAction | An Action that takes the KafkaConsumerConfigurationBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
AddConsumer(string, Action<KafkaConsumerConfigurationBuilder>)
Adds a Kafka consumer or updates its configuration if a consumer with the same name already exists.
Declaration
public KafkaClientsConfigurationBuilder AddConsumer(string name, Action<KafkaConsumerConfigurationBuilder> configurationBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The consumer name. |
| Action<KafkaConsumerConfigurationBuilder> | configurationBuilderAction | An Action that takes the KafkaConsumerConfigurationBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
AddDefaultConsumerConfiguration(Action<KafkaConsumerConfigurationBuilder>)
Add a default consumer configuration that will be applied to all the consumers.
This configuration action will be applied before any other consumer-specific configuration action.
Declaration
public KafkaClientsConfigurationBuilder AddDefaultConsumerConfiguration(Action<KafkaConsumerConfigurationBuilder> configurationBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<KafkaConsumerConfigurationBuilder> | configurationBuilderAction | An Action that takes the KafkaConsumerConfigurationBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
AddDefaultProducerConfiguration(Action<KafkaProducerConfigurationBuilder>)
Add a default producer configuration that will be applied to all the producers.
This configuration action will be applied before any other producer-specific configuration action.
Declaration
public KafkaClientsConfigurationBuilder AddDefaultProducerConfiguration(Action<KafkaProducerConfigurationBuilder> configurationBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<KafkaProducerConfigurationBuilder> | configurationBuilderAction | An Action that takes the KafkaProducerConfigurationBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
AddProducer(Action<KafkaProducerConfigurationBuilder>)
Adds a Kafka producer.
Declaration
public KafkaClientsConfigurationBuilder AddProducer(Action<KafkaProducerConfigurationBuilder> configurationBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<KafkaProducerConfigurationBuilder> | configurationBuilderAction | An Action that takes the KafkaProducerConfigurationBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
AddProducer(string, Action<KafkaProducerConfigurationBuilder>)
Adds a Kafka producer or updates its configuration if a producer with the same name already exists.
Declaration
public KafkaClientsConfigurationBuilder AddProducer(string name, Action<KafkaProducerConfigurationBuilder> configurationBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The producer name. |
| Action<KafkaProducerConfigurationBuilder> | configurationBuilderAction | An Action that takes the KafkaProducerConfigurationBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
DisableApiVersionRequest()
Disables the API versions requests and uses the fallback version specified in BrokerVersionFallback.
Declaration
public KafkaClientsConfigurationBuilder DisableApiVersionRequest()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
DisableMetricsPush()
Disables pushing of client metrics to the cluster.
Declaration
public KafkaClientsConfigurationBuilder DisableMetricsPush()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder DisableSaslOauthbearerUnsecureJwt()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
DisableSocketKeepalive()
Disables the TCP keep-alive (SO_KEEPALIVE) on the broker sockets.
Declaration
public KafkaClientsConfigurationBuilder DisableSocketKeepalive()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
DisableSocketNagle()
Disables the Nagle's algorithm (TCP_NODELAY) on the broker sockets.
Declaration
public KafkaClientsConfigurationBuilder DisableSocketNagle()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
DisableSparseTopicMetadataRefresh()
Disables sparse topic metadata requests.
Declaration
public KafkaClientsConfigurationBuilder DisableSparseTopicMetadataRefresh()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
DisableSslCertificateVerification()
Disables the SSL certificate validation.
Declaration
public KafkaClientsConfigurationBuilder DisableSslCertificateVerification()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder EnableApiVersionRequest()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder EnableMetricsPush()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder EnableSaslOauthbearerUnsecureJwt()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
EnableSocketKeepalive()
Enables the TCP keep-alive (SO_KEEPALIVE) on the broker sockets.
Declaration
public KafkaClientsConfigurationBuilder EnableSocketKeepalive()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
EnableSocketNagle()
Enables the Nagle's algorithm (TCP_NODELAY) on the broker sockets.
Declaration
public KafkaClientsConfigurationBuilder EnableSocketNagle()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
EnableSparseTopicMetadataRefresh()
Enables Generates less topic metadata requests (consuming less network bandwidth).
Declaration
public KafkaClientsConfigurationBuilder EnableSparseTopicMetadataRefresh()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
EnableSslCertificateVerification()
Enables the SSL certificate validation.
Declaration
public KafkaClientsConfigurationBuilder EnableSslCertificateVerification()
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithAcks(Acks? acks)
Parameters
| Type | Name | Description |
|---|---|---|
| Acks? | acks | The number of acknowledgements that the leader broker must receive from the in-sync replicas. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithApiVersionFallbackMs(int?)
Sets how long the BrokerVersionFallback is used in the case the API version request fails.
Declaration
public KafkaClientsConfigurationBuilder WithApiVersionFallbackMs(int? apiVersionFallbackMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | apiVersionFallbackMs | How long the fallback API version must be used. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithApiVersionRequestTimeoutMs(int?)
Sets the timeout (in milliseconds) for the broker API version requests.
Declaration
public KafkaClientsConfigurationBuilder WithApiVersionRequestTimeoutMs(int? apiVersionRequestTimeoutMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | apiVersionRequestTimeoutMs | The timeout for the broker API version requests. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithBootstrapServers(string?)
Sets the comma-separated list of brokers (host or host:port).
Declaration
public KafkaClientsConfigurationBuilder WithBootstrapServers(string? bootstrapServers)
Parameters
| Type | Name | Description |
|---|---|---|
| string | bootstrapServers | The comma-separated list of brokers. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithBrokerAddressFamily(BrokerAddressFamily?)
Sets the allowed broker IP address families.
Declaration
public KafkaClientsConfigurationBuilder WithBrokerAddressFamily(BrokerAddressFamily? brokerAddressFamily)
Parameters
| Type | Name | Description |
|---|---|---|
| BrokerAddressFamily? | brokerAddressFamily | The allowed broker IP address families. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithBrokerAddressTtl(int?)
Sets the duration in milliseconds of the cache of the broker address resolving results.
Declaration
public KafkaClientsConfigurationBuilder WithBrokerAddressTtl(int? brokerAddressTtl)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | brokerAddressTtl | The duration in milliseconds of the cache of the broker address resolving results. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithBrokerVersionFallback(string? brokerVersionFallback)
Parameters
| Type | Name | Description |
|---|---|---|
| string | brokerVersionFallback | The broker API version to be used as fallback. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithCancellationDelayMaxMs(int cancellationDelayMaxMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cancellationDelayMaxMs | The maximum time (in milliseconds) before a cancellation request is acted on. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithClientDnsLookup(ClientDnsLookup? clientDnsLookup)
Parameters
| Type | Name | Description |
|---|---|---|
| ClientDnsLookup? | clientDnsLookup | A value indicating how the client uses DNS lookups. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithClientId(string?)
Sets the client identifier.
Declaration
public KafkaClientsConfigurationBuilder WithClientId(string? clientId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | clientId | The client identifier. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithClientRack(string? clientRack)
Parameters
| Type | Name | Description |
|---|---|---|
| string | clientRack | The rack identifier for this client. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithConnectionsMaxIdleMs(int? connectionsMaxIdleMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | connectionsMaxIdleMs | The maximum time of inactivity. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithDebug(string? debug)
Parameters
| Type | Name | Description |
|---|---|---|
| string | debug | The comma-separated list of debug contexts to enable. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithHttpsCaLocation(string?)
Gets 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).
Declaration
public KafkaClientsConfigurationBuilder WithHttpsCaLocation(string? httpsCaLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | httpsCaLocation | The file or directory path to CA certificate(s) for verifying HTTPS endpoints. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithHttpsCaPem(string? httpsCaPem)
Parameters
| Type | Name | Description |
|---|---|---|
| string | httpsCaPem | The CA certificate string (in PEM format) for verifying HTTPS endpoints. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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 request per broker to one.
Declaration
public KafkaClientsConfigurationBuilder WithMaxInFlight(int? maxInFlight)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | maxInFlight | The maximum number of in-flight requests per broker connection. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithMessageCopyMaxBytes(int? messageCopyMaxBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | messageCopyMaxBytes | The maximum size for a message to be copied into the buffer. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithMessageMaxBytes(int?)
Sets the maximum message size.
Declaration
public KafkaClientsConfigurationBuilder WithMessageMaxBytes(int? messageMaxBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | messageMaxBytes | The maximum message size. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithMetadataMaxAgeMs(int?)
Sets the metadata cache max age (in milliseconds). Defaults to TopicMetadataRefreshIntervalMs.
Declaration
public KafkaClientsConfigurationBuilder WithMetadataMaxAgeMs(int? metadataMaxAgeMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | metadataMaxAgeMs | The metadata cache max age. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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 obtain 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().
Declaration
public KafkaClientsConfigurationBuilder WithMetadataRecoveryRebootstrapTriggerMs(int? metadataRecoveryRebootstrapTriggerMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | metadataRecoveryRebootstrapTriggerMs | The interval, in milliseconds, after which the client will rebootstrap if metadata cannot be obtained.
Default: |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithMetadataRecoveryStrategy(MetadataRecoveryStrategy? metadataRecoveryStrategy)
Parameters
| Type | Name | Description |
|---|---|---|
| MetadataRecoveryStrategy? | metadataRecoveryStrategy | The metadata recovery strategy to use. See Confluent.Kafka.MetadataRecoveryStrategy for available values. Default: Confluent.Kafka.MetadataRecoveryStrategy.Rebootstrap. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithPluginLibraryPaths(string? pluginLibraryPaths)
Parameters
| Type | Name | Description |
|---|---|---|
| string | pluginLibraryPaths | The list of plugin libraries to load ( |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithReceiveMessageMaxBytes(int? receiveMessageMaxBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | receiveMessageMaxBytes | The maximum response message size. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithReconnectBackoffMaxMs(int? reconnectBackoffMaxMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | reconnectBackoffMaxMs | The maximum time to wait before reconnecting to a broker. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithReconnectBackoffMs(int? reconnectBackoffMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | reconnectBackoffMs | The initial time to wait before reconnecting to a broker. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithRetryBackoffMaxMs(int? retryBackoffMaxMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | retryBackoffMaxMs | The maximum backoff time in milliseconds before retrying a protocol request. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithRetryBackoffMs(int? retryBackoffMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | retryBackoffMs | The backoff time in milliseconds before retrying a protocol request. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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}".
Declaration
public KafkaClientsConfigurationBuilder WithSaslKerberosKeytab(string? saslKerberosKeytab)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslKerberosKeytab | The path to the Kerberos keytab file. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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).
Declaration
public KafkaClientsConfigurationBuilder WithSaslKerberosKinitCmd(string? saslKerberosKinitCmd)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslKerberosKinitCmd | The shell command to be used to refresh or acquire the client's Kerberos ticket. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslKerberosMinTimeBeforeRelogin(int? saslKerberosMinTimeBeforeRelogin)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | saslKerberosMinTimeBeforeRelogin | The minimum time in milliseconds between each key refresh attempts. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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).
Declaration
public KafkaClientsConfigurationBuilder WithSaslKerberosPrincipal(string? saslKerberosPrincipal)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslKerberosPrincipal | The client's Kerberos principal name. (Not supported on Windows, will use the logon user's principal). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSaslKerberosServiceName(string?)
Sets the Kerberos principal name that Kafka runs as, not including /hostname@REALM.
Declaration
public KafkaClientsConfigurationBuilder WithSaslKerberosServiceName(string? saslKerberosServiceName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslKerberosServiceName | The Kerberos principal name that Kafka runs as. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslMechanism(SaslMechanism? saslMechanism)
Parameters
| Type | Name | Description |
|---|---|---|
| SaslMechanism? | saslMechanism | The SASL mechanism. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionAlgorithm(SaslOauthbearerAssertionAlgorithm? saslOauthbearerAssertionAlgorithm)
Parameters
| Type | Name | Description |
|---|---|---|
| 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
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionClaimAud(string? saslOauthbearerAssertionClaimAud)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionClaimAud | The JWT audience claim. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionClaimExpSeconds(int? saslOauthbearerAssertionClaimExpSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | saslOauthbearerAssertionClaimExpSeconds | The assertion expiration time in seconds. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionClaimIss(string? saslOauthbearerAssertionClaimIss)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionClaimIss | The JWT issuer claim. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionClaimJtiInclude(bool? saslOauthbearerAssertionClaimJtiInclude)
Parameters
| Type | Name | Description |
|---|---|---|
| bool? | saslOauthbearerAssertionClaimJtiInclude | The JWT ID claim. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionClaimNbfSeconds(int? saslOauthbearerAssertionClaimNbfSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | saslOauthbearerAssertionClaimNbfSeconds | The assertion not before time in seconds. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionClaimSub(string? saslOauthbearerAssertionClaimSub)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionClaimSub | The JWT subject claim. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionFile(string? saslOauthbearerAssertionFile)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionFile | The path to the assertion file. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionJwtTemplateFile(string? saslOauthbearerAssertionJwtTemplateFile)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionJwtTemplateFile | The path to the JWT template file. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionPrivateKeyFile(string? saslOauthbearerAssertionPrivateKeyFile)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionPrivateKeyFile | The path to the client's private key (PEM) used for authentication when using the JWT assertion. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionPrivateKeyPassphrase(string? saslOauthbearerAssertionPrivateKeyPassphrase)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionPrivateKeyPassphrase | The private key passphrase for |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSaslOauthbearerAssertionPrivateKeyPem(string?)
Sets the client's private key (PEM) used for authentication when using the JWT assertion.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerAssertionPrivateKeyPem(string? saslOauthbearerAssertionPrivateKeyPem)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerAssertionPrivateKeyPem | The client's private key (PEM) used for authentication when using the JWT assertion. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerClientId(string? saslOauthbearerClientId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerClientId | The public identifier for the application. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerClientSecret(string? saslOauthbearerClientSecret)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerClientSecret | The client secret only known to the application and the authorization server. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerConfig(string? saslOauthbearerConfig)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerConfig | The SASL/OAUTHBEARER configuration. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerExtensions(string? saslOauthbearerExtensions)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerExtensions | The additional information to be provided to the broker as a comma-separated list of |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSaslOauthbearerGrantType(SaslOauthbearerGrantType?)
Sets the OAuth grant type to use when communicating with the identity provider.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerGrantType(SaslOauthbearerGrantType? saslOauthbearerGrantType)
Parameters
| Type | Name | Description |
|---|---|---|
| SaslOauthbearerGrantType? | saslOauthbearerGrantType | The OAuth grant type to use when communicating with the identity provider. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerMetadataAuthenticationType(SaslOauthbearerMetadataAuthenticationType? saslOauthbearerMetadataAuthenticationType)
Parameters
| Type | Name | Description |
|---|---|---|
| SaslOauthbearerMetadataAuthenticationType? | saslOauthbearerMetadataAuthenticationType | The type of metadata-based authentication to use for OAUTHBEARER/OIDC. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerMethod(SaslOauthbearerMethod? saslOauthbearerMethod)
Parameters
| Type | Name | Description |
|---|---|---|
| SaslOauthbearerMethod? | saslOauthbearerMethod | The login method to be used. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerScope(string? saslOauthbearerScope)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerScope | The scope of the access request to the broker. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSaslOauthbearerTokenEndpointUrl(string? saslOauthbearerTokenEndpointUrl)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslOauthbearerTokenEndpointUrl | The OAuth/OIDC issuer token endpoint HTTP(S) URI used to retrieve the token. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSaslPassword(string?)
Sets the SASL password to use with the PLAIN and SASL-SCRAM-.. mechanisms.
Declaration
public KafkaClientsConfigurationBuilder WithSaslPassword(string? saslPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslPassword | The SASL password to use with the PLAIN and SASL-SCRAM-.. mechanisms. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSaslUsername(string?)
Sets the SASL username to use with the PLAIN and SASL-SCRAM-.. mechanisms.
Declaration
public KafkaClientsConfigurationBuilder WithSaslUsername(string? saslUsername)
Parameters
| Type | Name | Description |
|---|---|---|
| string | saslUsername | The SASL username to use with the PLAIN and SASL-SCRAM-.. mechanisms. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSecurityProtocol(SecurityProtocol?)
Sets the protocol to be used to communicate with the brokers.
Declaration
public KafkaClientsConfigurationBuilder WithSecurityProtocol(SecurityProtocol? securityProtocol)
Parameters
| Type | Name | Description |
|---|---|---|
| SecurityProtocol? | securityProtocol | The protocol to be used to communicate with the brokers. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSocketConnectionSetupTimeoutMs(int? socketConnectionSetupTimeoutMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | socketConnectionSetupTimeoutMs | The maximum time allowed for the setup of the broker connection. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSocketMaxFails(int? socketMaxFails)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | socketMaxFails | The maximum number of send failures before disconnecting. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSocketReceiveBufferBytes(int?)
Sets the socket receive buffer size. The system default is used if 0.
Declaration
public KafkaClientsConfigurationBuilder WithSocketReceiveBufferBytes(int? socketReceiveBufferBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | socketReceiveBufferBytes | The socket receive buffer size. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSocketSendBufferBytes(int?)
Sets the socket send buffer size. The system default is used if 0.
Declaration
public KafkaClientsConfigurationBuilder WithSocketSendBufferBytes(int? socketSendBufferBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | socketSendBufferBytes | The socket send buffer size. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSocketTimeoutMs(int?)
Sets the default timeout (in milliseconds) for network requests.
Declaration
public KafkaClientsConfigurationBuilder WithSocketTimeoutMs(int? socketTimeoutMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | socketTimeoutMs | The default timeout for network requests. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSslCaCertificateStores(string? sslCaCertificateStores)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCaCertificateStores | A comma-separated list of Windows certificate stores to load CA certificates from. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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).
Declaration
public KafkaClientsConfigurationBuilder WithSslCaLocation(string? sslCaLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCaLocation | The file or directory path to the CA certificate(s) for verifying the broker's key. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslCaPem(string?)
Sets the CA certificate string (in PEM format) for verifying the broker's key.
Declaration
public KafkaClientsConfigurationBuilder WithSslCaPem(string? sslCaPem)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCaPem | The CA certificate string (in PEM format). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslCertificateLocation(string?)
Sets the path to the client's public key (PEM) used for the authentication.
Declaration
public KafkaClientsConfigurationBuilder WithSslCertificateLocation(string? sslCertificateLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCertificateLocation | The path to the client's public key (PEM). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslCertificatePem(string?)
Sets the client's public key string (in PEM format) used for the authentication.
Declaration
public KafkaClientsConfigurationBuilder WithSslCertificatePem(string? sslCertificatePem)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCertificatePem | The client's public key string (in PEM format). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslCipherSuites(string?)
Sets the SSL cipher suites.
Declaration
public KafkaClientsConfigurationBuilder WithSslCipherSuites(string? sslCipherSuites)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCipherSuites | The SSL cipher suites. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslCrlLocation(string?)
Sets the path to the certificate revocation list (CRL) for verifying broker's certificate validity.
Declaration
public KafkaClientsConfigurationBuilder WithSslCrlLocation(string? sslCrlLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCrlLocation | The path to the certificate revocation list (CRL). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslCurvesList(string?)
Sets the supported SSL curves.
Declaration
public KafkaClientsConfigurationBuilder WithSslCurvesList(string? sslCurvesList)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslCurvesList | The supported SSL curves. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithSslEndpointIdentificationAlgorithm(SslEndpointIdentificationAlgorithm? sslEndpointIdentificationAlgorithm)
Parameters
| Type | Name | Description |
|---|---|---|
| SslEndpointIdentificationAlgorithm? | sslEndpointIdentificationAlgorithm | The endpoint identification algorithm to be used to validate the broker hostname. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslEngineId(string?)
Sets the OpenSSL engine id (the name used for loading engine).
Declaration
public KafkaClientsConfigurationBuilder WithSslEngineId(string? sslEngineId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslEngineId | The OpenSSL engine id. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslEngineLocation(string?)
Sets the path to the OpenSSL engine library. OpenSSL >= 1.1.0 required.
Declaration
public KafkaClientsConfigurationBuilder WithSslEngineLocation(string? sslEngineLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslEngineLocation | The path to the OpenSSL engine library. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslKeyLocation(string?)
Sets the path to the client's private key (PEM) used for the authentication.
Declaration
public KafkaClientsConfigurationBuilder WithSslKeyLocation(string? sslKeyLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslKeyLocation | The path to the client's private key (PEM). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslKeyPassword(string?)
Sets the private key passphrase.
Declaration
public KafkaClientsConfigurationBuilder WithSslKeyPassword(string? sslKeyPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslKeyPassword | The private key passphrase. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslKeyPem(string?)
Sets the client's private key string (in PEM format) used for the authentication.
Declaration
public KafkaClientsConfigurationBuilder WithSslKeyPem(string? sslKeyPem)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslKeyPem | The client's private key string (in PEM format). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslKeystoreLocation(string?)
Sets the path to the client's keystore (PKCS#12) used for the authentication.
Declaration
public KafkaClientsConfigurationBuilder WithSslKeystoreLocation(string? sslKeystoreLocation)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslKeystoreLocation | The path to the client's keystore (PKCS#12). |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslKeystorePassword(string?)
Sets the client's keystore (PKCS#12) password.
Declaration
public KafkaClientsConfigurationBuilder WithSslKeystorePassword(string? sslKeystorePassword)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslKeystorePassword | The client's keystore (PKCS#12) password. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslProviders(string?)
Sets the comma-separated list of OpenSSL 3.0.x implementation providers.
Declaration
public KafkaClientsConfigurationBuilder WithSslProviders(string? sslProviders)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslProviders | The comma-separated list of OpenSSL 3.0.x implementation providers. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithSslSigalgsList(string?)
Sets the supported SSL signature algorithms.
Declaration
public KafkaClientsConfigurationBuilder WithSslSigalgsList(string? sslSigalgsList)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sslSigalgsList | The supported SSL signature algorithms. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithStatisticsIntervalMs(int? statisticsIntervalMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | statisticsIntervalMs | The statistics emit interval. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithTopicBlacklist(string? topicBlacklist)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicBlacklist | The comma-separated list of regular expressions for the topic black list. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithTopicMetadataPropagationMaxMs(int? topicMetadataPropagationMaxMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | topicMetadataPropagationMaxMs | The delay to be observed before marking a topic as non-existent. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder 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.
Declaration
public KafkaClientsConfigurationBuilder WithTopicMetadataRefreshFastIntervalMs(int? topicMetadataRefreshFastIntervalMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | topicMetadataRefreshFastIntervalMs | The refresh interval. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |
WithTopicMetadataRefreshIntervalMs(int?)
Sets the interval (in milliseconds) at which the topic and broker metadata is refreshed in order 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.
Declaration
public KafkaClientsConfigurationBuilder WithTopicMetadataRefreshIntervalMs(int? topicMetadataRefreshIntervalMs)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | topicMetadataRefreshIntervalMs | The interval at which the topic and broker metadata is refreshed. |
Returns
| Type | Description |
|---|---|
| KafkaClientsConfigurationBuilder | The KafkaClientsConfigurationBuilder so that additional calls can be chained. |