Common configurations

There are many configurations for the Kafka Consumer API. Let’s look at some of the most important ones. In the process, we will also cover some of the best practices of using the Consumer API.

Let’s start with some of the commonly used Consumer API configurations.

The bootstrap.servers configuration

This configuration specifies the list of Kafka brokers the consumer should connect to. The value should be a comma-separated list of the hostname and port pairs.

The group.id configuration

This configuration is required for a consumer to join a consumer group. Consumers with the same group.id configuration belong to the same consumer group and are assigned partitions of the subscribed topics. Each partition can only be assigned to one consumer within a group. If multiple consumers share the same group.id configuration, Kafka will automatically perform a rebalance to reassign partitions to the available consumers within the group.

We use descriptive and unique group IDs for each consumer group to ensure clarity and avoid conflicts.

Get hands-on with 1400+ tech skills courses.