Free template.NET 10

Build with Microservices

Place an order and watch a second service record it. Stop the broker or send the same message twice to test the failure paths.

Loading signup form...

You'll also get The .NET Weekly newsletter. Unsubscribe anytime.

Secure Delivery
Email Delivery
No Credit Card

Created by Milan Jovanović
.NET and software architecture

Orders / message delivery.NET 10
TWO SERVICES · SEPARATE DATAOrdersPOST /ordersOrder + outboxone transactionNotificationsConsume OrderPlacedV1Inbox + notificationone transactionRabbitMQConfirmed publish → durable queue → consumer ackOrders databaseOrders credentials onlyNotifications databaseNotifications credentials onlyRetries can repeat a message. The inbox prevents duplicate records.
2 APIs2 PostgreSQL databases1 message broker
Trace one order from the HTTP request to the consumer.
  • .NET 10
  • RabbitMQ
  • PostgreSQL
  • Docker Compose

2

Separate services

2

PostgreSQL databases

.NET 10

Framework

Free

Source code

Make the failure paths part of the design.

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

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.

Outbox delivery

Accept an order while the broker is down.

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

Make retries safe for these writes.

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

Fix a failure. Replay the message.

Inspect failed messages in the dead-letter queue. Restore the database, then replay a valid message.

Start the stack. Place your first order.

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.

microservices/
src/Orders

Order API and outbox publisher

src/Contracts

OrderPlacedV1 message

src/Notifications

Consumer, inbox, read API

tests/smoke.ps1

Retries and failure checks

Run this from the project folder. The script creates local passwords and starts the stack.

pwsh ./run.ps1

Order → outbox → message → inbox

Before you download

What is in the download?

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.

Do I need MassTransit or a cloud account?

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.

Where should I start reading the code?

Start with the Orders endpoint and OutboxPublisher. Follow OrderPlacedV1 to OrderConsumer and NotificationStore. The run guide shows how those files fit together.

Get the Microservices template

Get the source, failure tests, and run guide in one free download.

Get the free template

No credit card. Runs locally with Docker Compose.