Service boundaries
Give each service its own data.
Two APIs, two PostgreSQL databases, and separate credentials. The shared contract describes a message. Neither API reaches into the other database.
Place an order and watch a second service record it. Stop the broker or send the same message twice to test the failure paths.
You'll also get The .NET Weekly newsletter. Unsubscribe anytime.
Created by Milan Jovanović
.NET and software architecture
2
Separate services
2
PostgreSQL databases
.NET 10
Framework
Free
Source code
Orders and Notifications have separate data. An event connects them. You can see when a write commits, when a message is sent, and what a retry does.
Service boundaries
Two APIs, two PostgreSQL databases, and separate credentials. The shared contract describes a message. Neither API reaches into the other database.
Outbox delivery
The order and its message commit in one transaction. The publisher keeps trying and marks the message sent after RabbitMQ confirms it.
Inbox + request keys
Repeat the HTTP request and get the same order. Deliver the event twice and get one notification record. The tests cover both paths.
Failure and recovery
Inspect failed messages in the dead-letter queue. Restore the database, then replay a valid message.
Unzip the project and open it in your editor. You need Docker with Compose and PowerShell 7. The containers include .NET.
Use examples.http to place an order and read its notification. The event arrives later, so the first read may need a retry.
src/OrdersOrder API and outbox publisher
src/ContractsOrderPlacedV1 message
src/NotificationsConsumer, inbox, read API
tests/smoke.ps1Retries and failure checks
Run this from the project folder. The script creates local passwords and starts the stack.
pwsh ./run.ps1Order → outbox → message → inbox
The full .NET 10 source, Docker Compose stack, unit tests, failure and recovery scripts, sample HTTP requests, a dead-letter replay tool, and a run guide.
No. The code uses the RabbitMQ .NET client directly. Everything runs locally with Docker Compose. You need the .NET 10 SDK only to build or run unit tests on your host.
Start with the Orders endpoint and OutboxPublisher. Follow OrderPlacedV1 to OrderConsumer and NotificationStore. The run guide shows how those files fit together.
Get the source, failure tests, and run guide in one free download.
Get the free templateNo credit card. Runs locally with Docker Compose.