Outbox in an ASP.NET Core scenario

Hi @jbogard

What I used to recommend in the past is using SQL Server transport in the web tier (on the boundary of the system) and some other transport, like RabbitMQ inside the system. This allows me to use the same SQL transaction to store data and send messages.

To make this approach work I recommend using NServiceBus.Router to move messages between the transports in a transparent way. The Router supports all types of communication (send, reply, publish).

If you look at this patter from outside, it is just the Outbox but implemented in a distributed way:

  • The web endpoint stores the outbox entries (SQL Server transport messages)
  • The Router endpoint removes the outbox entries and dispatches “real” messages

There is a sample that demonstrates how to use this approach to do atomic update-and-publish in the web controller.

Szymon