Class CommonClientConfigBuilder

All Implemented Interfaces:
CommonClientConfigFields<CommonClientConfigBuilder>

public class CommonClientConfigBuilder extends BaseCommonClientConfigBuilder<CommonClientConfigBuilder>
  • Constructor Details

    • CommonClientConfigBuilder

      public CommonClientConfigBuilder()
  • Method Details

    • build

      default <R> R build(Function<Map<String,Object>,R> fn)
    • property

      default CommonClientConfigBuilder property(String key, Object value)
    • asSupplier

      default Supplier<Map<String,Object>> asSupplier()
    • bootstrapServers

      public CommonClientConfigBuilder bootstrapServers(List<String> value)
      Description copied from interface: CommonClientConfigFields

      bootstrap.servers

      A list of host/port pairs to use for establishing the initial connection to the Kafka cluster.
      The client will make use of all servers irrespective of which servers are specified here for bootstrapping—this list only impacts the initial hosts used to discover the full set of servers.
      This list should be in the form 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).

      Default:

      Valid Values:

      Importance: high

      Specified by:
      bootstrapServers in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • bootstrapServers

      public CommonClientConfigBuilder bootstrapServers(String value)
      Description copied from interface: CommonClientConfigFields

      bootstrap.servers

      A list of host/port pairs to use for establishing the initial connection to the Kafka cluster.
      The client will make use of all servers irrespective of which servers are specified here for bootstrapping—this list only impacts the initial hosts used to discover the full set of servers.
      This list should be in the form 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).

      Default:

      Valid Values:

      Importance: high

      Specified by:
      bootstrapServers in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • clientId

      public CommonClientConfigBuilder clientId(String value)
      Description copied from interface: CommonClientConfigFields

      client.id

      An id string to pass to the server when making requests.
      The purpose of this is to be able to track the source of requests beyond just ip/port by allowing a logical application name to be included in server-side request logging.

      Default: ""

      Valid Values:

      Importance: medium

      Specified by:
      clientId in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • metadataMaxAgeMs

      public CommonClientConfigBuilder metadataMaxAgeMs(Long value)
      Description copied from interface: CommonClientConfigFields

      metadata.max.age.ms

      The period of time in milliseconds 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.

      Default: 300000 (5 minutes)

      Valid Values: [0,...]

      Importance: low

      Specified by:
      metadataMaxAgeMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • sendBufferBytes

      public CommonClientConfigBuilder sendBufferBytes(Integer value)
      Description copied from interface: CommonClientConfigFields

      send.buffer.bytes

      The size of the TCP send buffer (SO_SNDBUF) to use when sending data.
      If the value is -1, the OS default will be used.

      Default: 131072 (128 kibibytes)

      Valid Values: [-1,...]

      Importance: medium

      Specified by:
      sendBufferBytes in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • receiveBufferBytes

      public CommonClientConfigBuilder receiveBufferBytes(Integer value)
      Description copied from interface: CommonClientConfigFields

      receive.buffer.bytes

      The size of the TCP receive buffer (SO_RCVBUF) to use when reading data.
      If the value is -1, the OS default will be used.

      Default: 65536 (64 kibibytes)

      Valid Values: [-1,...]

      Importance: medium

      Specified by:
      receiveBufferBytes in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • reconnectBackoffMs

      public CommonClientConfigBuilder reconnectBackoffMs(Long value)
      Description copied from interface: CommonClientConfigFields

      reconnect.backoff.ms

      The base amount of time to wait before attempting to reconnect to a given host.
      This avoids repeatedly connecting to a host in a tight loop.
      This backoff applies to all connection attempts by the client to a broker.

      Default: 50

      Valid Values: [0,...]

      Importance: low

      Specified by:
      reconnectBackoffMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • reconnectBackoffMaxMs

      public CommonClientConfigBuilder reconnectBackoffMaxMs(Long value)
      Description copied from interface: CommonClientConfigFields

      reconnect.backoff.max.ms

      The maximum amount of time in milliseconds to wait when reconnecting to a broker that has repeatedly failed to connect.
      If provided, the backoff per host will increase exponentially for each consecutive connection failure, up to this maximum.
      After calculating the backoff increase, 20% random jitter is added to avoid connection storms.

      Default: 1000 (1 second)

      Valid Values: [0,...]

      Importance: low

      Specified by:
      reconnectBackoffMaxMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • retryBackoffMs

      public CommonClientConfigBuilder retryBackoffMs(Long value)
      Description copied from interface: CommonClientConfigFields

      retry.backoff.ms

      The amount of time to wait before attempting to retry a failed request.
      This avoids repeatedly sending requests in a tight loop under some failure scenarios.

      Default: 100

      Valid Values: [0,...]

      Importance: low

      Specified by:
      retryBackoffMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • requestTimeoutMs

      public CommonClientConfigBuilder requestTimeoutMs(Integer value)
      Description copied from interface: CommonClientConfigFields

      request.timeout.ms

      The configuration controls the maximum amount of time the client will wait for the response of a request.
      If the response is not received before the timeout elapses the client will resend the request if necessary or fail the request if retries are exhausted.

      Default: 30000 (30 seconds)

      Valid Values: [0,...]

      Importance: medium

      Specified by:
      requestTimeoutMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • connectionsMaxIdleMs

      public CommonClientConfigBuilder connectionsMaxIdleMs(Long value)
      Description copied from interface: CommonClientConfigFields

      connections.max.idle.ms

      Close idle connections after the number of milliseconds specified by this config.

      Default: 300000 (5 minutes)

      Valid Values:

      Importance: medium

      Specified by:
      connectionsMaxIdleMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • metricsSampleWindowMs

      public CommonClientConfigBuilder metricsSampleWindowMs(Long value)
      Description copied from interface: CommonClientConfigFields

      metrics.sample.window.ms

      The window of time a metrics sample is computed over.

      Default: 30000 (30 seconds)

      Valid Values: [0,...]

      Importance: low

      Specified by:
      metricsSampleWindowMs in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • metricsNumSamples

      public CommonClientConfigBuilder metricsNumSamples(Integer value)
      Description copied from interface: CommonClientConfigFields

      metrics.num.samples

      The number of samples maintained to compute metrics.

      Default: 2

      Valid Values: [1,...]

      Importance: low

      Specified by:
      metricsNumSamples in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • metricReporters

      public CommonClientConfigBuilder metricReporters(List<String> value)
      Description copied from interface: CommonClientConfigFields

      metric.reporters

      A list of classes to use as metrics reporters.
      Implementing the 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.

      Default: ""

      Valid Values:

      Importance: low

      Specified by:
      metricReporters in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • metricReporters

      public CommonClientConfigBuilder metricReporters(String value)
      Description copied from interface: CommonClientConfigFields

      metric.reporters

      A list of classes to use as metrics reporters.
      Implementing the 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.

      Default: ""

      Valid Values:

      Importance: low

      Specified by:
      metricReporters in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • metricsRecordingLevel

      public CommonClientConfigBuilder metricsRecordingLevel(String value)
      Description copied from interface: CommonClientConfigFields

      metrics.recording.level

      The highest recording level for metrics.

      Default: INFO

      Valid Values: [INFO, DEBUG, TRACE]

      Importance: low

      Specified by:
      metricsRecordingLevel in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>
    • securityProtocol

      public CommonClientConfigBuilder securityProtocol(String value)
      Description copied from interface: CommonClientConfigFields

      security.protocol

      Protocol used to communicate with brokers.
      Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.

      Default: PLAINTEXT

      Valid Values: [PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL]

      Importance: medium

      Specified by:
      securityProtocol in interface CommonClientConfigFields<T extends org.swisspush.kobuka.client.base.AbstractCommonClientConfigBuilder<T>>