Particular / NServiceBus.Transport.Msmq

MSMQ transport for NServiceBus
https://docs.particular.net/nservicebus/msmq/
Other
5 stars 11 forks source link

Validate that the connection string does not contain `Enlist=False` #660

Open ramonsmits opened 4 months ago

ramonsmits commented 4 months ago

Describe the feature.

A customer had an issue where delayed delivery was not working as expected. The problem was causes by a wrong connection string. The connection string had the value Enlist=False. The default value is True and is the required value for consistency when having a distributed transaction between the MSMQ transport and the SQL database:

The ConnectionString property supports a keyword, Enlist, which indicates whether Microsoft.Data.SqlClient will detect transactional contexts and automatically enlist the connection in a distributed transaction. If Enlist=true, the connection is automatically enlisted in the opening thread's current transaction context. If Enlist=false, the SqlClient connection does not interact with a distributed transaction. The default value for Enlist is true. If Enlist is not specified in the connection string, the connection is automatically enlisted in a distributed transaction if one is detected when the connection is opened.

Source: https://learn.microsoft.com/en-us/sql/connect/ado-net/system-transactions-integration-with-sql-server?view=sql-server-ver16#connection-string-keywords

We could validate if the connection string does not have Enlist=False set as that would generate duplicate delayed messages.

Additional Context

No response