Articles
Practical, deeply explained engineering writing — free to read, no sign-up required.
All Articles
Transactional Outbox Pattern with EF Core & RabbitMQ
The Transactional Outbox Pattern saves your business data and outgoing event in the same SQL database transaction. A background worker then reads that outbox table and publishes the event to RabbitMQ, preventing lost messages if the broker or app crashes.
Hosting Background Consumers with BackgroundService in .NET
In ASP.NET Core, inherit from BackgroundService to run a RabbitMQ consumer safely alongside your web API. It gives you built-in dependency injection, structured logging, and a CancellationToken for graceful shutdowns.
Quorum Queues & RabbitMQ Streams for High Availability
A Quorum Queue replicates messages across multiple RabbitMQ nodes using Raft consensus so a server crash never loses data. A RabbitMQ Stream is an append-only log that lets multiple .NET services read and replay the same events at their own pace.
Consumer Idempotency & Deduplication in .NET
RabbitMQ guarantees at-least-once delivery, which means your .NET consumer will eventually receive the same message twice. Idempotency ensures that processing a duplicate MessageId does nothing extra, preventing double charges or duplicate orders.
Implementing Delayed Retries with Exponential Backoff
Delayed retries hold failed messages in separate TTL (Time-To-Live) queues before a Dead-Letter Exchange (DLX) sends them back for another try. Increasing the wait time on each failure (such as 5s, 15s, 45s) lets brief database or Bank API outages heal on their own.
Dead-Letter Exchanges (DLX) & Poison Message Handling
A Dead-Letter Exchange (DLX) automatically catches rejected or expired messages and routes them to a separate Dead-Letter Queue (DLQ). This stops one broken message from crashing your .NET worker in an endless loop and blocking healthy traffic.
Manual Acknowledgments & Consumer Prefetch (BasicQos)
Turn off autoAck so RabbitMQ keeps every message safe until your C# worker explicitly calls BasicAck. Pair it with BasicQos prefetch limits so a crashing worker never hoards or drops in-flight tasks.
Message Durability, Persistence & Publisher Confirms
To prevent message loss during a RabbitMQ restart, you need three things together: durable exchanges and queues, persistent messages written to disk, and Publisher Confirms so your C# app knows the broker safely saved the message.
Request-Reply (RPC) Pattern with Correlation IDs in C#
The Request-Reply (RPC) pattern lets a .NET service send a message over RabbitMQ and wait for an answer. You attach a unique CorrelationId and a ReplyTo address to each request, so the caller matches the exact reply when it comes back.
Headers Exchanges & Message Metadata Routing
A Headers Exchange ignores the routing key and routes messages using custom key-value AMQP headers. Queues choose x-match: all (every header must match) or x-match: any (at least one header must match).
Topic Exchanges – Wildcard Pattern Routing (* and #)
A Topic Exchange routes messages by matching dot-delimited routing keys against wildcard patterns. Use * to match exactly one word and # to match zero or more words, so each .NET service receives only the events it needs.
Fanout Exchanges – Pub/Sub Broadcasting Across Services
A Fanout Exchange copies every incoming message to all queues bound to it. It ignores routing keys completely. Use it when one event must trigger multiple independent .NET microservices at the exact same time.