Skip to content

1.1.1

Compare
Choose a tag to compare
@johnsimons johnsimons released this 02 Apr 07:38
· 1902 commits to master since this release

As part of this release we had 9 commits which resulted in 1 issue being closed.

Bugs

#26 Messages not getting sent when SqlConnection is used inside message handlers

It appears that when custom SQL queries to MS SQL Server (using SqlConnection) are made during the lifetime of a NServiceBus message handler, non-deterministic behavior is resulted. Sometimes ambient transaction is never committed, which results in NServiceBus.RabbitMQ never sending out messages that should be sent. That is apparently because flushing of NSB's unit of work is bound to TransactionCompleted event, which sometimes never launches.

I'm able to work around the issue the following way: instead of letting SqlConnection to automatically enlist to ambient transaction, I'm preventing it using 'Enlist=false' in connection string. I don't use System.Transactions at all with the SqlConnection, but I hook up SqlTransaction using NServiceBus'es IManageUnitsOfWork interface.

The issue can be reproduced: https://github.com/peuramaki/NServiceBus.RabbitMq.Issue26

EDIT: workaround suggested here doesn't fix my production scenario, non-deterministic behavior continues.

It also seems that if I forget to close the SqlConnection (or return it to connection pool), non-deterministic behavior is gone.

Where to get it

You can download this release from nuget