Consistency and failures
No distributed transactions and no pretending the network does not fail. Rule and data stay in one transaction, in the owning service; consequences (notify, e-mail) go out afterwards through a queue and fail without breaking the request. On the consumer side: retry with backoff and dead letters, nothing is lost silently.
Decisions and why
- Rule and data in the same transaction
- Moving the operation and checking the locks happen in one commit. If it fails, nothing changed.
- Consequences through a queue, published asynchronously
- A broker outage becomes a log warning, never a failed request for the user.
- Retry with backoff, then dead letter
- Transient failures retry after 2 s and 4 s; what keeps failing is parked with its reason for reprocessing.
- A message that can never succeed is not retried
- No recipient or an invalid payload goes straight to the dead letter (AmqpRejectAndDontRequeue): it does not clog the queue.
- Tests against the real broker
- Delivery, retry and dead letter are tested on Testcontainers RabbitMQ, not a mock.
requestresponse
Pick a scenario above to watch the message travel through the architecture.