intermediate~2h
Persistence Layer
This is where consumed events stop being ephemeral. Postgres, Flyway, and the NEW-vs-UPDATE logic that makes the consumer more than a dumb logger.
Learning objectives
- Beginner: Persist NEW events as straightforward inserts, accepting that a duplicate redelivery would currently fail on a primary-key collision (a known gap to close next).
- Intermediate: Make save() upsert-safe (as shown above) so redelivery of the same event is a no-op rather than an error.
- Advanced: Combine idempotent persistence here with the producer's idempotent send (Module 13) and consumer transactions (Module 16) for end-to-end exactly-once effect despite at-least-once delivery at every hop.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.
Persistence Layer