Hi all,
when I call the consumer.pause() and consumer.resume() functions I get the following error
{ Error: Local: Erroneous state
at Function.createLibrdkafkaError [as create] (/home/node/app/node_modules/node-rdkafka/lib/error.js:260:10)
at KafkaConsumer.Client._errorWrap (/home/node/app/node_modules/node-rdkafka/lib/client.js:470:29)
at KafkaConsumer.pause (/home/node/app/node_modules/node-rdkafka/lib/kafka-consumer.js:614:15)
at <anonymous>
message: 'Local: Erroneous state',
code: -172,
errno: -172,
origin: 'kafka' }
As I deduced from the code, I am passing an array of topicPartitions objects.
Since these methods are not documented, am I missing something?
Thanks!
Checking the source, chances are that you're not subscribed to a group (consumer.subscribe(toppars)), which is a prerequisite to pausing or resuming consumption.
I've looked into it a little bit deeper to determine whether that's a limitation brought on by node-rdkafka or librdkafka (what it binds to) or inherent to Kafka. The original java source of KafkaConsumer has the same limitation, also revealing that it's actually the subscription that's being paused implementation wise. The documentation on the pause / resume mechanism further explains that it's a way for KafkaConsumer to keep polling for new messages, remaining active and alive within a ConsumerGroup, while not having to consume messages from some topics while maybe consuming others from other topics.
Most helpful comment
Checking the source, chances are that you're not subscribed to a group (
consumer.subscribe(toppars)), which is a prerequisite to pausing or resuming consumption.I've looked into it a little bit deeper to determine whether that's a limitation brought on by
node-rdkafkaorlibrdkafka(what it binds to) or inherent to Kafka. The original java source of KafkaConsumer has the same limitation, also revealing that it's actually the subscription that's being paused implementation wise. The documentation on the pause / resume mechanism further explains that it's a way forKafkaConsumerto keep polling for new messages, remaining active and alive within aConsumerGroup, while not having to consume messages from some topics while maybe consuming others from other topics.