Blizzard / node-rdkafka

Node.js bindings for librdkafka
MIT License
2.11k stars 396 forks source link

How to get the committed offset on the consumer side #985

Closed patrickckfcdc closed 1 year ago

patrickckfcdc commented 1 year ago

I am evaluating node-rdkafka library on some use cases.

I use the "committed" function to try to get the committed offset, but no matter how long I configure in the timeout there is no response from the callback.

Global Config

{
"group.id": "test_group",
"client.id": "test_group",
"socket.keepalive.enable": true,
"partition.assignment.strategy": "roundrobin",
"group.instance.id": "test_group_0",
"enable.auto.commit": false,
"metadata.broker.list": "127.0.0.1:9094,
}

Consumer Topic Config

{
"auto.offset.reset": "beginning",
"consume.callback.max.messages": 10000,
}
consumer.commit([{topic, partition}], 5000, (err, offsets) => {
 if (err) {
 // err handle
 } else {
 // handle the committed offsets
 }
});

Is there anything missing in the configuration? please suggest. Thanks in advance.