`resume` on a `consumer` is not resuming consuming the messages.
reeshabhranjan opened this issue · comments
Reeshabh Kumar Ranjan commented
Describe the bug
I followed this example: https://kafka.js.org/docs/consuming#a-name-pause-resume-a-pause-resume.
Inside a cron of every 5 seconds, I send an integer from a producer to a consumer. When the counter hits 5
, I pause the consumer like this:
this.consumer.pause([{ topic: `test` }]);
When the producer tries to send 11
, I resume the consumer like this:
this.consumer.resume([{ topic: `test` }]);
I then see these logs:
pushed 2
received 2
pushed 3
received 3
pushed 4
received 4
pushed 5
received 5
Pausing
{"level":"INFO","timestamp":"2023-11-23T12:15:45.018Z","logger":"kafkajs","message":"[ConsumerGroup] Pausing fetching from 1 topics","topicPartitions":[{"topic":"transaction-test"}]}
pushed 6
pushed 7
pushed 8
pushed 9
pushed 10
Resuming
{"level":"INFO","timestamp":"2023-11-23T12:16:15.002Z","logger":"kafkajs","message":"[ConsumerGroup] Resuming fetching from 1 topics","topicPartitions":[{"topic":"transaction-test"}]}
pushed 11
pushed 12
pushed 13
pushed 14
Expected behavior
The consumer should start consuming the messages soon after it is resume
-ed.
Observed behavior
The consumer never starts consuming the messages even after it is resume
-ed.
Environment:
- Docker
- KafkaJS version
"kafkajs": "^2.2.3"
- Kafka version
7.3.0
- NodeJS version
node:18-alpine
Reeshabh Kumar Ranjan commented
fixed it by updating kafkajs
in package.json
to the latest available (2.2.4
)