haskell-works / hw-kafka-client

Kafka client for Haskell, including auto-rebalancing consumers
MIT License
139 stars 50 forks source link

Provide `offsetsForTimes` #162

Closed sir4ur0n closed 3 years ago

sir4ur0n commented 3 years ago

Librdkafka supports offsetsForTimes which allows one to find (for each partition) the first offset at a given timestamp. This is typically useful for failure recovery (e.g. replay all messages from the last backup or from the data loss point).

I propose this feature is also added to hw-kafka-client, what do you think? If you agree, maybe someone in my team could try to add this feature, do you have any particular constraints (which module, signature, whatever)?

References:

AlexeyRaga commented 3 years ago

Have a look if this would work for you?

https://github.com/haskell-works/hw-kafka-client/blob/master/src/Kafka/Metadata.hs#L148 https://github.com/haskell-works/hw-kafka-client/blob/master/src/Kafka/Metadata.hs#L162 https://github.com/haskell-works/hw-kafka-client/blob/master/src/Kafka/Metadata.hs#L172

sir4ur0n commented 3 years ago

Well, I feel silly, I have no clue why I didn't find those earlier, sorry :bow:

Thank you @AlexeyRaga !