org.apache.kafka.clients.consumer
Class ConsumerConfig

java.lang.Object
  extended by org.apache.kafka.common.config.AbstractConfig
      extended by org.apache.kafka.clients.consumer.ConsumerConfig

public class ConsumerConfig
extends AbstractConfig

The consumer configuration keys


Field Summary
static java.lang.String AUTO_COMMIT_INTERVAL_MS_CONFIG
          The frequency in milliseconds that the consumer offsets are committed to Kafka.
static java.lang.String AUTO_OFFSET_RESET_CONFIG
          What to do when there is no initial offset in Kafka or if an offset is out of range: smallest: automatically reset the offset to the smallest offset largest: automatically reset the offset to the largest offset disable: throw exception to the consumer if no previous offset is found for the consumer's group anything else: throw exception to the consumer.
static java.lang.String BOOTSTRAP_SERVERS_CONFIG
          A list of URLs to use for establishing the initial connection to the cluster.
static java.lang.String CLIENT_ID_CONFIG
          The id string to pass to the server when making requests.
static java.lang.String ENABLE_AUTO_COMMIT_CONFIG
          If true, periodically commit to Kafka the offsets of messages already returned by the consumer.
static java.lang.String FETCH_BUFFER_CONFIG
          The minimum amount of memory that should be used to fetch at least one message for a partition.
static java.lang.String FETCH_MAX_WAIT_MS_CONFIG
          The maximum amount of time the server will block before answering the fetch request if there isn't sufficient data to immediately satisfy FETCH_MIN_BYTES_CONFIG.
static java.lang.String FETCH_MIN_BYTES_CONFIG
          The minimum amount of data the server should return for a fetch request.
static java.lang.String GROUP_ID_CONFIG
          The identifier of the group this consumer belongs to.
static java.lang.String HEARTBEAT_FREQUENCY
          The number of times a consumer sends a heartbeat to the co-ordinator broker within a SESSION_TIMEOUT_MS time window.
static java.lang.String METADATA_FETCH_TIMEOUT_CONFIG
          The maximum amount of time to block waiting to fetch metadata about a topic the first time a record is received from that topic.
static java.lang.String METRIC_REPORTER_CLASSES_CONFIG
          metric.reporters
static java.lang.String METRICS_NUM_SAMPLES_CONFIG
          metrics.num.samples
static java.lang.String METRICS_SAMPLE_WINDOW_MS_CONFIG
          metrics.sample.window.ms
static java.lang.String PARTITION_ASSIGNMENT_STRATEGY
          The friendly name of the partition assignment strategy that the server will use to distribute partition ownership amongst consumer instances when group management is used
static java.lang.String RECONNECT_BACKOFF_MS_CONFIG
          The amount of time to wait before attempting to reconnect to a given host.
static java.lang.String SESSION_TIMEOUT_MS
          The timeout after which, if the poll(timeout) is not invoked, the consumer is marked dead and a rebalance operation is triggered for the group identified by GROUP_ID_CONFIG.
static java.lang.String SOCKET_RECEIVE_BUFFER_CONFIG
          The size of the TCP send buffer to use when fetching data
static java.lang.String TOTAL_BUFFER_MEMORY_CONFIG
          The total memory used by the consumer to buffer records received from the server.
 
Method Summary
 
Methods inherited from class org.apache.kafka.common.config.AbstractConfig
get, getBoolean, getClass, getConfiguredInstance, getConfiguredInstances, getDouble, getInt, getList, getLong, getString, logUnused, unused
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_ID_CONFIG

public static final java.lang.String GROUP_ID_CONFIG
The identifier of the group this consumer belongs to. This is required if the consumer uses either the group management functionality by using subscribe(topics). This is also required if the consumer uses the default Kafka based offset management strategy.

See Also:
Constant Field Values

SESSION_TIMEOUT_MS

public static final java.lang.String SESSION_TIMEOUT_MS
The timeout after which, if the poll(timeout) is not invoked, the consumer is marked dead and a rebalance operation is triggered for the group identified by GROUP_ID_CONFIG. Relevant if the consumer uses the group management functionality by invoking subscribe(topics)

See Also:
Constant Field Values

HEARTBEAT_FREQUENCY

public static final java.lang.String HEARTBEAT_FREQUENCY
The number of times a consumer sends a heartbeat to the co-ordinator broker within a SESSION_TIMEOUT_MS time window. This frequency affects the latency of a rebalance operation since the co-ordinator broker notifies a consumer of a rebalance in the heartbeat response. Relevant if the consumer uses the group management functionality by invoking subscribe(topics)

See Also:
Constant Field Values

BOOTSTRAP_SERVERS_CONFIG

public static final java.lang.String BOOTSTRAP_SERVERS_CONFIG
A list of URLs to use for establishing the initial connection to the cluster. This list should be in the form host1:port1,host2:port2,.... These urls are just used for the initial connection to discover the full cluster membership (which may change dynamically) so this list need not contain the full set of servers (you may want more than one, though, in case a server is down).

See Also:
Constant Field Values

ENABLE_AUTO_COMMIT_CONFIG

public static final java.lang.String ENABLE_AUTO_COMMIT_CONFIG
If true, periodically commit to Kafka the offsets of messages already returned by the consumer. This committed offset will be used when the process fails as the position from which the consumption will begin.

See Also:
Constant Field Values

PARTITION_ASSIGNMENT_STRATEGY

public static final java.lang.String PARTITION_ASSIGNMENT_STRATEGY
The friendly name of the partition assignment strategy that the server will use to distribute partition ownership amongst consumer instances when group management is used

See Also:
Constant Field Values

AUTO_COMMIT_INTERVAL_MS_CONFIG

public static final java.lang.String AUTO_COMMIT_INTERVAL_MS_CONFIG
The frequency in milliseconds that the consumer offsets are committed to Kafka. Relevant if ENABLE_AUTO_COMMIT_CONFIG is turned on.

See Also:
Constant Field Values

AUTO_OFFSET_RESET_CONFIG

public static final java.lang.String AUTO_OFFSET_RESET_CONFIG
What to do when there is no initial offset in Kafka or if an offset is out of range:

See Also:
Constant Field Values

FETCH_MIN_BYTES_CONFIG

public static final java.lang.String FETCH_MIN_BYTES_CONFIG
The minimum amount of data the server should return for a fetch request. If insufficient data is available the request will wait for that much data to accumulate before answering the request.

See Also:
Constant Field Values

FETCH_MAX_WAIT_MS_CONFIG

public static final java.lang.String FETCH_MAX_WAIT_MS_CONFIG
The maximum amount of time the server will block before answering the fetch request if there isn't sufficient data to immediately satisfy FETCH_MIN_BYTES_CONFIG. This should be less than or equal to the timeout used in poll(timeout)

See Also:
Constant Field Values

METADATA_FETCH_TIMEOUT_CONFIG

public static final java.lang.String METADATA_FETCH_TIMEOUT_CONFIG
The maximum amount of time to block waiting to fetch metadata about a topic the first time a record is received from that topic. The consumer will throw a TimeoutException if it could not successfully fetch metadata within this timeout.

See Also:
Constant Field Values

TOTAL_BUFFER_MEMORY_CONFIG

public static final java.lang.String TOTAL_BUFFER_MEMORY_CONFIG
The total memory used by the consumer to buffer records received from the server. This config is meant to control the consumer's memory usage, so it is the size of the global fetch buffer that will be shared across all partitions.

See Also:
Constant Field Values

FETCH_BUFFER_CONFIG

public static final java.lang.String FETCH_BUFFER_CONFIG
The minimum amount of memory that should be used to fetch at least one message for a partition. This puts a lower bound on the consumer's memory utilization when there is at least one message for a partition available on the server. This size must be at least as large as the maximum message size the server allows or else it is possible for the producer to send messages larger than the consumer can fetch. If that happens, the consumer can get stuck trying to fetch a large message on a certain partition.

See Also:
Constant Field Values

CLIENT_ID_CONFIG

public static final java.lang.String CLIENT_ID_CONFIG
The 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.

See Also:
Constant Field Values

SOCKET_RECEIVE_BUFFER_CONFIG

public static final java.lang.String SOCKET_RECEIVE_BUFFER_CONFIG
The size of the TCP send buffer to use when fetching data

See Also:
Constant Field Values

RECONNECT_BACKOFF_MS_CONFIG

public static final java.lang.String RECONNECT_BACKOFF_MS_CONFIG
The 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 requests sent by the consumer to the broker.

See Also:
Constant Field Values

METRICS_SAMPLE_WINDOW_MS_CONFIG

public static final java.lang.String METRICS_SAMPLE_WINDOW_MS_CONFIG
metrics.sample.window.ms

See Also:
Constant Field Values

METRICS_NUM_SAMPLES_CONFIG

public static final java.lang.String METRICS_NUM_SAMPLES_CONFIG
metrics.num.samples

See Also:
Constant Field Values

METRIC_REPORTER_CLASSES_CONFIG

public static final java.lang.String METRIC_REPORTER_CLASSES_CONFIG
metric.reporters

See Also:
Constant Field Values