Can I use same group id between Kafka Streams topology and a normal Kafka consumer?

53 views Asked by At

My service is a Kafka Streams application which has let's say application ID set as "service1" consuming from topic A. I believe this ID becomes the group ID of the consumer in Kafka Streams topology. Now, I want to create a new simple consumer using Micronaut Kafka to consume from a different topic (topic B) in the same service. Is there a way to use "service1" as the group ID for the Micronaut Kafka consumer as well? I tried to put the same ID but I started getting the following error:

The group member's supported protocols are incompatible with those of existing members or first group member tried to join with empty protocol type or empty protocol list.

Thanks in advance.

1

There are 1 answers

0
OneCricketeer On

You can create two separate consumer groups in the same application. There's no benefit of using the same.

Otherwise, make it part of the same topology. Consume both topics using Kafka Streams and use branch operator to split apart the topics, then have topic A be your existing code, then topic B can be consumed with a foreach operator, or whatever