public class AbstractConfigBuilder<T extends AbstractConfigBuilder<T>> extends Object implements ConfigBuilder
| Constructor and Description |
|---|
AbstractConfigBuilder() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
buildMap() |
Properties |
buildProperties()
Builds config into java.util.Properties class to use with Kafka consumers, producers or admin clients
|
T |
withBootstrapServers(List<String> bootstrapServers)
A list of host/port pairs to use for establishing the initial connection to the Kafka cluster.
|
T |
withBootstrapServers(String bootstrapServers)
A list of host/port pairs to use for establishing the initial connection to the Kafka cluster.
|
T |
withClientDNSLookup(org.apache.kafka.clients.ClientDnsLookup clientDNSLookup)
Controls how the client uses DNS lookups.
|
T |
withClientId(String clientId)
An id string to pass to the server when making requests.
|
T |
withClientRack(String clientRack)
A rack identifier for this client.
|
T |
withConnectionsMaxIdle(Duration connectionsMaxIdle)
Close idle connections after the duration specified by this config.
|
T |
withCustom(String name,
Object value)
Use custom configuration property
|
T |
withCustomMap(Map<String,Object> propertyMap)
Use custom configuration property map
|
T |
withMetadataMaxAge(Duration metadataMaxAge)
The period of time after which we force a refresh of metadata even if we haven't seen any partition leadership changes to proactively discover any new brokers or partitions.
|
T |
withMetricReporterClasses(Class<?>... metricReporterClasses)
A list of classes to use as metrics reporters.
|
T |
withMetricsNumSamples(int metricsNumSamples)
The number of samples maintained to compute metrics.
|
T |
withMetricsRecordingLevel(org.apache.kafka.common.metrics.Sensor.RecordingLevel metricsRecordingLevel)
The highest recording level for metrics.
|
T |
withMetricsSampleWindow(Duration metricsSampleWindow)
The window of time a metrics sample is computed over.
|
T |
withReceiveBufferBytes(int receiveBufferBytes)
The size of the TCP receive buffer (SO_RCVBUF) to use when reading data.
|
T |
withReconnectBackoff(Duration reconnectBackoff)
The base amount of time to wait before attempting to reconnect to a given host.
|
T |
withReconnectBackoffMax(Duration reconnectBackoffMax)
The maximum amount of time in milliseconds to wait when reconnecting to a broker that has repeatedly failed to connect.
|
T |
withRequestTimeout(Duration requestTimeout)
The configuration controls the maximum amount of time the client will wait
for the response of a request.
|
T |
withRetryBackoff(Duration retryBackoff)
The amount of time to wait before attempting to retry a failed request to a given topic partition.
|
T |
withSaslMechanism(String saslMechanism)
SASL mechanism used for client connections.
|
T |
withSecurityProtocol(org.apache.kafka.common.security.auth.SecurityProtocol securityProtocol)
Protocol used to communicate with brokers.
|
T |
withSecurityProviders(Class<? extends org.apache.kafka.common.security.auth.SecurityProviderCreator>... securityProviders)
A list of configurable creator classes each returning a provider
implementing security algorithms.
|
T |
withSendBufferBytes(int sendBufferBytes)
The size of the TCP send buffer (SO_SNDBUF) to use when sending data.
|
T |
withSocketConnectionSetupTimeout(Duration socketConnectionSetupTimeout)
The amount of time the client will wait for the socket connection to be established.
|
T |
withSocketConnectionSetupTimeoutMax(Duration socketConnectionSetupTimeoutMax)
The maximum amount of time the client will wait for the socket connection to be established.
|
public T withBootstrapServers(String bootstrapServers)
host1:port1,host2:port2,.... Since these servers are just used for the initial connection to
discover the full cluster membership (which may change dynamically), this list need not contain the full set of
servers (you may want more than one, though, in case a server is down).public T withBootstrapServers(List<String> bootstrapServers)
host1:port1,host2:port2,.... Since these servers are just used for the initial connection to
discover the full cluster membership (which may change dynamically), this list need not contain the full set of
servers (you may want more than one, though, in case a server is down).public T withClientId(String clientId)
public T withClientRack(String clientRack)
public T withClientDNSLookup(org.apache.kafka.clients.ClientDnsLookup clientDNSLookup)
Controls how the client uses DNS lookups.
If set to use_all_dns_ips then, when the lookup returns multiple IP addresses for a hostname,
they will all be attempted to connect to before failing the connection. Applies to both bootstrap and advertised servers.
If the value is resolve_canonical_bootstrap_servers_only each entry will be resolved and expanded into a list of canonical names.
public T withMetadataMaxAge(Duration metadataMaxAge)
public T withSendBufferBytes(int sendBufferBytes)
public T withReceiveBufferBytes(int receiveBufferBytes)
public T withReconnectBackoff(Duration reconnectBackoff)
public T withReconnectBackoffMax(Duration reconnectBackoffMax)
public T withRetryBackoff(Duration retryBackoff)
public T withMetricsSampleWindow(Duration metricsSampleWindow)
public T withMetricsNumSamples(int metricsNumSamples)
public T withMetricsRecordingLevel(org.apache.kafka.common.metrics.Sensor.RecordingLevel metricsRecordingLevel)
public T withMetricReporterClasses(Class<?>... metricReporterClasses)
org.apache.kafka.common.metrics.MetricsReporter interface allows plugging in classes that will be notified of new metric creation.
The JmxReporter is always included to register JMX statistics.public T withConnectionsMaxIdle(Duration connectionsMaxIdle)
public T withRequestTimeout(Duration requestTimeout)
public T withSecurityProtocol(org.apache.kafka.common.security.auth.SecurityProtocol securityProtocol)
public T withSaslMechanism(String saslMechanism)
@SafeVarargs public final T withSecurityProviders(Class<? extends org.apache.kafka.common.security.auth.SecurityProviderCreator>... securityProviders)
org.apache.kafka.common.security.auth.SecurityProviderCreator interface.public T withSocketConnectionSetupTimeout(Duration socketConnectionSetupTimeout)
public T withSocketConnectionSetupTimeoutMax(Duration socketConnectionSetupTimeoutMax)
public T withCustom(String name, Object value)
name - property namevalue - property valuepublic T withCustomMap(Map<String,Object> propertyMap)
propertyMap - name-value map pairspublic Properties buildProperties()
buildProperties in interface ConfigBuilderpublic Map<String,Object> buildMap()
buildMap in interface ConfigBuilderCopyright © 2021. All rights reserved.