rebus-org / Rebus.TransactionScopes

:bus: System.Transactions.TransactionScope enlistment helper for Rebus

Home Page:https://mookid.dk/category/rebus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rebus.TransactionScopes

install from nuget

Provides a System.Transactions.TransactionScope helper for Rebus.


Use it like this when you send/publish things from anywhere besides inside Rebus handlers:

using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
	scope.EnlistRebus();

	// this one is automatically enlisted in the ambient .NET transaction
	await _bus.Send("ostemad");

	scope.Complete();
}

Use it like this to have Rebus handlers invoked inside a TransactionScope:

Configure.With(...)
    .(...)
    .Options(o =>
    {
        o.HandleMessagesInsideTransactionScope();
    })
    .Start();

By default, the transaction scope will use the IsolationLevel.ReadCommitted isolation level with a 1 minute timeout. These values can be configured by passing an instance of TransactionOptions to HandleMessagesInsideTransactionScope.

That's about it.

About

:bus: System.Transactions.TransactionScope enlistment helper for Rebus

https://mookid.dk/category/rebus

License:Other


Languages

Language:C# 85.9%Language:Batchfile 14.1%