title: Out-of-the-box capabilities for Spring-Kafka consumer to avoid duplicate message processing
body: <p>I stumbled over <a href="https://chrisrichardson.net/post/microservices/patterns/2020/10/16/idempotent-consumer.html" rel="nofollow noreferrer">Handling duplicate messages using the Idempotent consumer pattern</a> :
  <a href="https://i.stack.imgur.com/t34y0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t34y0.png" alt="enter image description here" /></a></p>
  <p>Similar, but slightly different is the <a href="https://event-driven.io/en/outbox_inbox_patterns_and_delivery_guarantees_explained/" rel="nofollow noreferrer">Transactional Inbox Pattern</a> which acknowledges the kafka message receipt after the transaction <code>INSERT into messages</code> (no business transaction) concluded successfully and having a background polling to detect new messages in this table and trigger the real business logic (i.e. the message listener) subsequently.</p>
  <p>Now I wonder, if there is a Spring magic to just provide a special DataSource config to track all received messages and discard duplicated message deliveries?
  Otherwise, the application itself would need to take care to ack the kafka message receipt, message state changes and data cleanup of the event table, retry after failure and probably a lot of other difficult things that I did not yet thought about.</p>