kafka
kafka copied to clipboard
"--from-beginning" consumer equivalent?
With the kafka-console-consumer
, there's a --from-beginning
option for getting all messages across a topic's partitions. I've tried setting the startingOffset
:
const consumer = new kafka.GroupConsumer({
connectionString: KAFKA_URLS,
startingOffset: kafka.EARLIEST_OFFSET
});
as well as the time
in the subscribe call:
consumer.subscribe(KAFKA_XAPI_TOPIC, dataHandler, {
time: kafka.EARLIEST_OFFSET
})
.then(function (result) {
//
})
but neither of these seemed to do it. Is there a way to mimic that --from-beginning
behavior from the console consumer?