Outbox Pattern Not Working


I’m using the Outbox pattern which doesn’t appear to be working as my business data is failing to save but outgoing messages are still being published.

Looking at the code, I can see that the outbound message is published using an IMessageSession injected in when the app starts.

I was wondering whether the Outbox pattern relies on using the IMessageHandlerContext of the incoming message to send any outgoing messages?



Hi @robgardner,

IMessageSession does not participate in any transactions, and it is not intended to be used from inside a handler. That also means that any messages sent with it will ignore the outgoing Outbox mechanism as well.

You do need to use IMessageHandlerContext to send messages if want them to participate with the Outbox.

If you are migrating older code that relied on IBus, we do have a Uniform Session package that can help with that migration, but for new code, maintaining the IMessageSession / IMessageHandlerContext separation is the recommended approach.