'Does Kafka DSL context.forward() ensures delivery?

I'm writing my custom KStream transformer and I want to store certain records to state store and later (from punctuate) resend them.
Yet I don't want to keep them in state store - and I have no tombstone in my flow to clean them later from the store - so I want to explicitly clean the records from store after they are forwarded:

   context.forward(key, value)
   store.delete(key)

I'm not sure if the message is not lost when there is failure later in topology.

Does KStream still ensures at-least-once delivery with such usage. For example by:

  1. context.forward() returns only after successful processing
  2. context.forward() return immediately but record is deleted from store only when all messages from context are processed
  3. any other mechanism....


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source