POC: A fun, practical way to play with the Azure Service Bus Emulator + Testcontainers for .NET and see real messages flowing through a local, containerized, event-driven system.
Spin it up. Spam it with events. Watch the worker process them. Magic. 🪄
This repository is a proof of concept for building and testing a message-driven .NET worker using:
- ✅ Azure Service Bus Emulator (Docker)
- ✅ Testcontainers for .NET
- ✅ Docker Compose
- ✅ .NET Worker Service
It allows you to:
- Run everything locally
- Send messages into Service Bus
- See the worker process them in real time
- Verify the full pipeline with integration tests
-
MessageProcessor.Worker
The background worker that listens to Azure Service Bus and processes messages. -
MessageProcessor.Tests
Integration tests using Testcontainers. -
ServiceBus.Spammer
A small console tool that sends one message per second.
Location:tools
- Docker
- .NET 10+ SDK
From the folder that contains `docker-compose.yml`:
docker compose up -dThis starts:
- Azure SQL Edge
- Azure Service Bus Emulator
- Service Bus Sentinel (health checker)
- Node
greetings-api MessageProcessor.WorkerServiceBus.Spammer
Verify everything is running:
docker psYou should see something like:
message-processor-worker Up ...
servicebus-emulator Up ...
sqlserver Up ...
This is the most important command in the whole project:
docker logs -f message-processor-workerYou should see:
...
Calculating the meaning of life for Message ID fc23a7a9-bbca-4af0-bc4b-86d2517b0c13... please wait.
Received: Message 1326 @ 2025-11-23T03:17:05.7212890Z
...
Leave this terminal open — it is your live processing feed.
These tests use Testcontainers to spin up the required infrastructure automatically.
From the repo root:
dotnet test MessageProcessor.Tests/MessageProcessor.Tests.csprojMake sure Docker is running before executing the tests.
docker compose up -d
docker logs -f message-processor-workerYou now have a local, containerized playground for:
- Azure Service Bus Emulator
- Azure Service Bus Emulator Spammer
- .NET worker
- Event-driven systems
- Integration testing
Have fun breaking it, fixing it, and making it better 😄