I have looked at reactive-kaka and am following some discussions on Gitter on the subject.
Can you elaborate how that works exactly? My main question is this: an Akka Stream flow does message processing in parallel. So what can happen is that the Kafka consumer has read two messages and both of them are still in some flow and have not reached the sink (= the Kafka writer who writes to an output topic) yet. Suppose the auto-commit happens now and we crash. In this case, I will have lost two messages. Correct?
If so, then auto-commit doesn't work. So we need to commit messages after they been written out.
Looking at reactive-kafka, I think they use approach two from my original mail:
val consumerWithOffsetSink = kafka.consumeWithOffsetSink(consumerProperties)
Source(consumerWithOffsetSink.publisher)
.map(processMessage(_)) // your message processing
.to(consumerWithOffsetSink.offsetCommitSink) // stream back for commit
.run()
You'd write your message out in processMessage.
– Kaspar