Closed nebelx closed 6 years ago
public void Commit(Enlistment enlistment)
{
_scope.Complete();
using (_transactionContext)
{
enlistment.Done();
}
}
The problem was caused by this code from AmbientTransactionBridge. _scope.Complete() makes all messages to be sent through transport. It does not matter if it is RabbitMq, Msmq or any other transport. If send fails - _scope.Complete() throws exception that is unhandled. In that case current transaction is not commited nor rolled back and TransactionCompleted event is not fired so AmbientTransactionContext is not set to null. That caused the prodlem described there https://github.com/rebus-org/Rebus.RabbitMq/issues/16.
It also would be great to cover this case with tests. But i's needed to have a transport than can fail. Mock implementaions feets good, but i don't know how do you feel about Mocking Frameworks.
Your fix is out in Rebus.TransactionScopes 4.0.1 in a few seconds – thanks 👍
Rebus is MIT-licensed. The code submitted in this pull request needs to carry the MIT license too. By leaving this text in, I hereby acknowledge that the code submitted in the pull request has the MIT license and can be merged with the Rebus codebase.