bsm/sarama-cluster

enable newconsumer to start at offset from X minutes ago

Closed this issue · 1 comments

While Sarama GetOffset allow to get the message offset from X seconds ago, this behaviour is not possible (easily) using Sarama Cluster.

In Sarama :

	// Time should be OffsetOldest for the earliest available offset,
	// OffsetNewest for the offset of the message that will be produced next, or a time.
	GetOffset(topic string, partitionID int32, time int64) (int64, error)

I see no way to get the consumer to start consuming at a time offset using Sarama Cluster.

Using the config parameter config.Consumer.Offsets.Initial will not help as it is meant to be an Offset ID, and it is checked to be only OffsetOldest or OffsetNewest in config.go

Also, this config have no sens as the offset of each partition will obviously not be the same...

While I'm going to spend a little time on this for a PR, I would greatly appreciate to have some recommendation on where to make this happen in the current code ?

Sounds it should go somewhere close to ConsumePartition code, but... ?

I don't want to break the API, but I would definitely need this feature.

closing, kind of duplicate of #179