Can two java instances belong to the same consumer group when kafka consumers are multithreaded?

configure concurrency
spring.kafka.listener.concurrency=50

when a springboot program uses
spring.kafka.consumer.group-id=orderGroup
@ KafkaListener (topics = "orders").

if the program deploys two instances
, are there 100 consumer threads that belong to the consumer group orderGroup?

Dec.19,2021

should be. After you start the program, you can take a look at it with the command of kafka:

 

look at how many consumption instances have been created for you, and groupID is the same. That belongs to the same group.

can serve as a redundant and loaded job, but it is not reasonable to allocate 100 instances in two processes.

you can have 4 processes, each process has N consumption instances, and the specific number depends on the number of partitions of your Topic .

Menu