title: How to seek Offset for Time Stamp with Spring for Kafka
body: <p>We are using spring-kafka to consume messages that have to be forwarded to the frontend as server sent events (SSE).</p>
  
  <p>When a user logs in she is to supposed to see all the events she missed out on since her last session.</p>
  
  <p>Current implementation uses the ConsumerSeekCallback as described in 
  <a href="https://stackoverflow.com/a/42999883/1938574">this answer</a></p>
  
  <p>However that callback does not support the offsetForTimes method of the underlying KafkaConsumer (<a href="https://kafka.apache.org/0102/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#offsetsForTimes(java.util.Map)" rel="nofollow noreferrer">KafkaConsumer#offsetForTimes</a>).</p>
  
  <p>So I have to use seekToBeginning and filter for the time stamp, which will cause problems when there are a lot of messages ...</p>
  
  <p>Is there any other way to receive only the messages since a given time stamp?
  Maybe a safe way to use the consumer directly?</p>