Consumer: Fails to subscribe after run()
See original GitHub issueHi guys, I have a follow up question to https://github.com/tulios/kafkajs/issues/336#issuecomment-490830101
I started to play around with kafkajs and tried to integrate it to our high-level solution. We need to dynamically subscribe to topics during runtime. To me it looks like subscribing to topics after consumer.run(…) was called does not add the new topic to the list of topics that get fetched in the ConsumerGroup:
(‘topic-test’ and ‘service__alpha’ gets subscribed before calling
run()
, ‘XXX’ after run()
)
Is it me doing it wrong, is the consumer not intended to be used in this way or did I stumble over a bug?
Thanks a lot in advance!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Kafka consumer api failed to subscribe to topic - Stack Overflow
I faced the same issue. I was using the kafka_2.12 jar version, when I downgrade it to kafka_2.11 it worked.
Read more >Consuming Messages - KafkaJS
This method has to be called after the consumer is initialized and is running (after consumer#run). await consumer.connect() await consumer.subscribe({ topics: ...
Read more >Kafka Consumer | Confluent Documentation
An Apache Kafka consumer group is a set of consumers which cooperate to consume data from some topics.
Read more >Introduction - Apache Kafka
Other servers run Kafka Connect to continuously import and export data as ... and consumers are those that subscribe to (read and process)...
Read more >KeyError while running snuba-subscription-consumer-events
Hi Sentry Team. We were missing running two sentry and snuba components (subscription-consumer-events and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tulios - Could you elaborate on what you mean by restarting the consumer? Like the OP I too have a need for dynamically creating and subscribing to topics. I tried calling consumer.stop() followed by consumer.run(), but that didn’t seem to help. I also tried just creating a new instance of the same consumer and subscribing to all existing topics again. That also didn’t seem to work.
Also, has there been any updates on supporting dynamic topics in a more natural way?
Anyone got solution for this??