A consumer group defines a group of consumers that read records from a topic in parallel. Each consumer in the group is assigned a subset of the topic's partitions to read from.
To create a consumer group or add a consumer to an existing group, set the
group.id
configuration in the consumer. For example, when using the Kafka command-line
tools, you can specify the consumer group as follows:
kafka-console-consumer.sh \
--topic TOPIC \
--bootstrap-server BOOTSTRAP \
--group GROUP \
--consumer.config client.properties
Replace the following:
TOPIC: the topic name.BOOTSTRAP: the bootstrap server.GROUP: the consumer group ID.
In Managed Service for Apache Kafka, you can manage consumer groups by using the Google Cloud console, Google Cloud CLI, the client libraries, or the Kafka command-line tools.