Part 20 · Applications

Kafka, AMQP and Pulsar: delivery boundaries

Prerequisites: 01-ecosystem

Where can a duplicate become a second effect?

Broker event: event ID = E42; Consumer: process + deduplicate; Business store: effect + event marker; Acknowledge / commit: after chosen boundary. Connections: Broker event to Consumer (delivery / redelivery); Consumer to Business store (durable effect); Consumer to Acknowledge / commit (processing outcome)
Application-level idempotency sketch; broker protocols and acknowledgement semantics differ. [S38] [S39] [S59]

Goal & mental model verified

Spring messaging integrations connect templates and listeners to broker-specific behavior. Kafka transactions can cover a read/process/write Kafka sequence; this does not universally make external database or HTTP side effects exactly once.

[S38] [S39]

Worked example · design exercise synthesis

A PolicyIssued event may be redelivered. A consumer records a stable event ID and performs its database change atomically where feasible, avoiding a second business effect on retry.

[S38] [S39] [S59]

Engineering decision synthesis

Use messaging to decouple timing and absorb work under explicit delivery rules. Choose the broker by ordering, routing, retention and operational requirements rather than a universal winner.

[S38] [S39] [S59]

Pitfall & diagnosis synthesis

Acknowledging before durable processing can lose work; acknowledging afterward can allow redelivery. “Exactly once” must name the protected boundary, and poison-message retries need a finite outcome.

[S38] [S39] [S59]

Improve & validate synthesis

Test a crash after the effect but before acknowledgement. Track lag, retries and dead-letter handling; verify deduplication with the actual transaction and broker configuration.

[S38] [S39] [S59]
Keep this: Assume retries can repeat business work unless your boundary proves otherwise.
Check yourself: Does Kafka EOS make an HTTP payment exactly once?

No. The external payment needs its own idempotency and coordination contract.

Sources & further reading

  1. [S38] Kafka exactly-once semantics

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Kafka transactional read/process/write boundary

    Read the linked section to validate the mechanism and its version-specific constraints.

  2. [S39] AMQP asynchronous consumer

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Listener containers and acknowledgement modes

    Read the linked section to validate the mechanism and its version-specific constraints.

  3. [S59] Spring Pulsar

    Spring project maintainers · documentation · accessed 2026-10-09 · Documentation retrieved 2026-10-09

    Supports: Spring template/listener abstractions for Pulsar

    Read the linked section to validate the mechanism and its version-specific constraints.