node-rdkafka icon indicating copy to clipboard operation
node-rdkafka copied to clipboard

Enhancement: Consumer should be able to know committed position before starting to fetch

Open edoardocomar opened this issue 8 years ago • 3 comments

The current consumer seems to be lacking the ability retrieve the its position or its list of committed offset before it has started fetching data.

I.E. position() and committed(timeout,cb) seem to work only in the on('data',...) event handler

In the Java consumer, a call to KafkaConsumer.committed(TopicPartition) can be made in the onPartitionsAssigned callback to subscribe the trick there is that the Java client goes and fetches the committed offset if it hasn't got any local data.

It would be nice to have this feature in the js client

edoardocomar avatar May 18 '17 09:05 edoardocomar

I think query watermark offset will do this for you, and that was added in a recent commit?

webmakersteve avatar May 19 '17 00:05 webmakersteve

Thanks, but those are the offsets the broker has a for a partition. That's metadata not connected with a consumer.

What we're looking after are the COMMITTED offset for a given consumer group and partition. that is - what we'd expect the committed call to return.

@edenhill can librdkafka mimic the that Java client functionality for this ?

edoardocomar avatar May 19 '17 09:05 edoardocomar

I wonder if we can call consume(0) to get the current offsets on start. Will have to experiment

webmakersteve avatar Jun 08 '17 04:06 webmakersteve