Reputation: 830
I want to create more than one Kafka consumer group in one spring boot application to process different different Kafka queue. Requirement scenario is based on the message criticality it should be pushed to different Kafka queue. And to manage different Kafka queue I want to create a dedicated Kafka consumer group. But I am not sure weather I can create more than one Kafka consumer group in one spring boot application or not.
Currently I am having three kafka topic with 4 partion per topic and only one kafka consumer group with three kafka consumer. These three kafka consumer reading from three dedicated kafka queue.
I googled but unable to find any clue regarding this.
Upvotes: 0
Views: 1505
Reputation: 121560
Your question not clear and sounds like you are not familiar with Kafka fully.
First of all that called topic
in Kafka, not queue. And it is the topic concept because we can subscriber different consumer groups to get the same message - the publish-subscriber semantic.
Not clear also why you need several consumer groups since even in the same group different consumers can consume from different topics.
Anyway you should consider to use:
/**
* Override the {@code group.id} property for the consumer factory with this value
* for this listener only.
* @return the group id.
* @since 1.3
*/
String groupId() default "";
On the @KafkaListener
for your purpose.
Upvotes: 1