title: Kafka Streams: how to get offset limits prior to application for reprocessing and how to stop it
body: <p>I'm looking for a way to do a reprocessing tool in KafkaStreams, that will allow to reprocess data from the beginning in a topic (applying some filters and writing updated versions of those events to the same topic). At the same time there is a long-running application processing data from that topic.</p>
  
  <p>In order to reprocess <em>only up to the point in time</em> at which the application is launched and stops after it, it is needed to know when to stop, which is the latest produced offset at that point. E.g. a map could be constructed prior to start the topology that will have (partition -> offset) to know those limits, so the application will be able to stop when that offset is reached, comparing current partition and offset (via Processor API) with the offset limit on that initial map.</p>
  
  <p>Is it possible/does it make sense to access latest offsets info from within Kafka Streams? Is there another way to work it around?
  (I guess you can get it creating via regular Kafka consumers, seeking end and getting position, but I'm asking if there is an integrated solution within KafkaStreams).</p>
  
  <p>Also, how to gently stop an application only when all of the partitions have reached its offset, knowing this info is distributed so you'll need to know the state from all instances?</p>
  
  <p>Kafka/KafkaStreams 2.1, Scala 2.12</p>