ConsumerConfig — Configuration Properties for KafkaConsumer

ConsumerConfig is a Apache Kafka AbstractConfig for the configuration properties of a KafkaConsumer.

import org.apache.kafka.clients.consumer.ConsumerConfig

val conf = new java.util.Properties()
conf.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, ":9092,localhost:9192")
import org.apache.kafka.common.serialization.Serdes
conf.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, Serdes.String.deserializer.getClass)
conf.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, Serdes.String.deserializer.getClass)

import org.apache.kafka.clients.consumer.KafkaConsumer
val consumer = new KafkaConsumer[String, String](conf)
Table 1. ConsumerConfig’s Configuration Properties
Name, Property, Default Value Description




Default: 5 mins

The period of time (in milliseconds) after which we force a refresh of metadata even if we haven’t seen any partition leadership changes. That is to proactively discover any new brokers or partitions.



Default: RangeAssignor

The class name of the partition assignment strategy that the client will use to distribute partition ownership amongst consumer instances when group management is used

Read up Kafka Client-side Assignment Proposal on the group management in Apache Kafka’s Consumer API.

Used when:

  • KafkaConsumer is created

  • Kafka Streams' StreamsConfig is requested to getMainConsumerConfigs

Required for KafkaConsumer to subscribe to topics


Default: 30000 ms

How long (in millis) a Kafka client waits for a response to 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.

Must be at least 0

results matching ""

    No results matching ""