confluentinc/kafka-rest

Question regarding setting position by datetime

ph1lm opened this issue · 1 comments

ph1lm commented

Hello,

We have a use case when offset should be set by datetime and we wouldn't want to use Producer API directly (offsetsForTimes() method in particular). Instead, we'd like to extend Kafka REST Proxy by adding this feature to the existent endpoint:
https://docs.confluent.io/platform/current/kafka-rest/api.html#post--consumers-(string-group_name)-instances-(string-instance)-positions

POST /consumers/(string:group_name)/instances/(string:instance)/positions
Overrides the fetch offsets that the consumer will use for the next set of records to fetch.

Request JSON Array of Objects:
 - offsets - A list of offsets
 - offsets[i].topic (string) - Name of the topic
 - offsets[i].partition (int) - Partition ID
 - offsets[i].offset (int) - Seek to offset for the next set of records to fetch
 - offsets[i].datetime (datetime in yyyy-MM-ddTHH:mm:ss.xxx format) - Seek to an earliest offset after the given datetime for the next set of records to fetch     <!------ This is the parameter we want to add

A couple of questions:

  • Do you think this is the right endpoint to be upgraded with such functionality or it's better to use another one?
  • Would such a feature be interesting for the community and project owners or this PR will be potentially rejected and it's better to find another way to do that?

Thank you

UPDATE:
I found one request for such feature: #716 (comment)

ph1lm commented

After walking through the code I found that this feature was already implemented exactly in the same endpoint: 2677245