Transactional session - Outbox support outside message handlers

Hi everyone,

We’ve just released the transactional session feature. The NServiceBus.TransactionalSession and the persistence-specific support packages provide outbox-like transaction support outside of message handlers, for example within ASP.NET controllers.

The new ITransactionalSession interface is an alternative to IMessageSession. The transactional session captures both the message sends/publishes, as well as database writes, and executes them atomically when committed.

When using the transactional session with the Outbox enabled, the session provides atomic consistency for message and database operations performed using ITransactionalSession.

For further information, refer to the NServiceBus.TransactionalSession documentation or try the NServiceBus.TransactionalSession samples.

Where to get it

You can install the persistence specific package from NuGet for the persistence of your choice.

With thanks,
The team in Particular

Please read our release policy for more details.

2 Likes

Hi everyone,

We have updated the ASP.NET Core sample to show a better approach on how to deal with the transactional session integration into the ASP.NET Core pipeline.

The tweaked approach selectively opts in for transactional session by using parameter injection

[HttpGet]
public async Task<string> Get([FromServices] ITransactionalSession messageSession)

which makes sure the transactional session interaction only happens for routes that actually need it.

Regards,
Daniel