TaskHub.Shared.Persistence.Outbox
Core abstractions for the Outbox pattern to ensure reliable message delivery.
Contents
Summary
- Interfaces for Outbox storage.
- Models for Outbox messages.
The Outbox pattern is used to ensure that a domain event is eventually published, even if the primary database transaction and the message broker are not part of a single distributed transaction.
Workflow
- Save: The domain event is saved as an “Outbox Message” in the same transaction as the domain entity.
- Retrieve: A background worker polls the Outbox table for unpublished messages.
- Publish: The worker publishes the message to the broker and marks it as processed in the Outbox.