Kafkajs: Consumer#unsubscribe() "missing"

Created on 6 Nov 2020  路  2Comments  路  Source: tulios/kafkajs

Is your feature request related to a problem? Please describe.

There doesn't seem to be a way to unsubscribe from a topic in a consumer.

Describe the solution you'd like

I think there's two parts here: From a user point of view I would expect a thing having a 'subscribe' to also have a 'unsubscribe' concept. If that doesn't exist though I probably would want some form of documentation on why that is an unreasonable expectation, or what is needed to make this happen.

I can see one work-around: One could stop the consumer, then "move" over the interesting topics to a new consumer, and then start that one. But that also seems to indicate that KafkaJS could offer me that :)

So this is a bit of a discussion:

  1. Should there be a unsubscribe?
  2. If yes: What's needed for it to be there (is it "just time to do it", or are there known issues with it?)
  3. If no: What could be added to the documentation to make this less "missing"?

Most helpful comment

FWIW: I think it would be "nice to have" an unsubscribe functionality, and I would assume that this basically boils down to implementing reasonable ways to change the target topics of a cluster and remove existing entries.

All 2 comments

FWIW: I think it would be "nice to have" an unsubscribe functionality, and I would assume that this basically boils down to implementing reasonable ways to change the target topics of a cluster and remove existing entries.

I would vote for yes. unsubscribe would be nice.
Imagine having some config storing which topics should be consumed. If that list changes it would be nice to be able to unsub, instead of restarting all consumers.

Was this page helpful?
0 / 5 - 0 ratings