The Outbox: An EIP Pattern

The Outbox

The outbox pattern, I believe, is missing from the Enterprise Integration Patterns book. This pattern is exactly like the local outbox that email clients have for disconnected operation.

How can producers reliably send messages when the broker/consumer is unavailable?

The producer of messages can durably store those messages in a local outbox before sending to a Message Endpoint. The durable local storage may be implemented in the Message Channel directly, especially when combined with Idempotent Messages.

This pattern is implied in the book inside the Guaranteed Messaging pattern. See the “Computer 1 Disk” inside the image.

This pattern avoids the following [The Lost Send]:

  1. Producer sends a message.
  2.  The Message Channel is temporarily unavailable.
  3. Messages will queue locally and periodically retry sending.

This pattern can be used to minimize [The Premature Send]:

  1. Producer sends a message within the context of some local processing scope or transactional boundary.
  2. After sending the message, but still within the same processing scope, the producer aborts and rolls back local changes.
  3. The message may already have been sent and processed.
  4. Either:
      1. The Producer can send another compensation message to undo actions,
      2. or the producer can first store messages in the Outbox and then at the end of the scope push or purge local messages.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Scroll to Top