Hello,

I'm working with the kafka streams api and am running into issues where I
subscribe to multiple topics and the consumer just hangs. It has a unique
application.id and I can see in kafka that the consumer group has been
created, but when I describe the group, I'll get: consumer group X has no
active members

The interesting thing is that this works when the topics list only contains
1 topic. I'm not interested in other answers where we create multiple
sources, ie: source1 = builder.stream("topic1") and source2 =
builder.stream("topic2") as the interface for StreamsBuilder.stream supports
an array of topics.

I've been able to subscribe to multiple topics before, I just can't
replicate how we've done this. (This code is running in a different
environment and working as expected, so not sure if it's a timing issue or
something else)

List<String> topics = Arrays.asList("topic1", "topic2");

StreamsBuilder builder = new StreamsBuilder();
KStream<String, String> source = builder.stream(topics);

source
.transformValues(...)
.map(key, value) -> ...)
.to((key, value, record) -> ...);

new KafkaStreams(builder.build(), props).start();

This question has been posted on stackoverflow in case you want to
answer there: 
https://stackoverflow.com/questions/56535113/kafka-streams-listening-to-multiple-topics-hangs

Reply via email to