In Kafka, a consumer group is a set of one or more consumers who cooperate to consume data from the same topic or the same set of topics. A consumer group basically represents the name of an application. Consumers in Kafka generally belong to a particular consumer group. To consume messages from a consumer group, ‘-group’ command has to be used.
xxxxxxxxxx
@Component
public class Consumer {
@KafkaListener(topics = {"test","test2"}, groupId = "myGroup", concurrency = "2")
public void processMessage(String content) {
System.out.println("Message received by consumer 1: " + content);
}
}
https://www.javatpoint.com/apache-kafka-consumer-and-consumer-groups