Node-rdkafka: Consumer pause/resume not working

Created on 18 Apr 2018  路  1Comment  路  Source: Blizzard/node-rdkafka

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!

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-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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clChenLiang picture clChenLiang  路  3Comments

ivomirra picture ivomirra  路  3Comments

maxplanck76er picture maxplanck76er  路  3Comments

corybill picture corybill  路  6Comments

Rick83600 picture Rick83600  路  3Comments