intermediatePersistence Layer

Why might a consumer intentionally write to a local database inside the SAME transaction as committing its Kafka offset?

Committing the Kafka offset and writing to the database are two separate systems — if the DB write succeeds but the app crashes before committing the offset, the message gets reprocessed (safe if idempotent); but if you want to avoid ANY duplicate processing risk, the 'offset commit as part of the DB transaction' pattern (rare, needs manual offset storage in the DB itself) ties both operations to one atomic outcome.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

Why might a consumer intentionally write to a local database inside the SAME transaction as committing its Kafka offset?

Next Step

Continue to Why is `@EmbeddedKafka` valuable for testing a Kafka consumer's rebalancing or retry behavior specifically?← Back to all Kafka & Microservices questions