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]:
- Producer sends a message.
- The Message Channel is temporarily unavailable.
- Messages will queue locally and periodically retry sending.
This pattern can be used to minimize [The Premature Send]:
- Producer sends a message within the context of some local processing scope or transactional boundary.
- After sending the message, but still within the same processing scope, the producer aborts and rolls back local changes.
- The message may already have been sent and processed.
- The Producer can send another compensation message to undo actions,
- or the producer can first store messages in the Outbox and then at the end of the scope push or purge local messages.