Particular / NServiceBus.Persistence.Sql

Native SQL Persistence for NServiceBus
https://docs.particular.net/persistence/sql/
Other
36 stars 27 forks source link

Transactional Session Messages not sent when using SQL outbox with TransactionScope #1193

Closed pardahlman closed 1 year ago

pardahlman commented 1 year ago

Describe the bug

Description

When using Transactional session with SQL outbox configured to use TransactionScope, no messages that are sent/published via ITransactionalSession are in fact sent/published to the transport as the session is commited.

Expected behavior

Messages sent/published via ITransactioanlSession should be sent/published when the session is committed.

Actual behavior

No messages are sent/published

Versions

NServiceBus 8.0.3 NServiceBus.Persistence.Sql.TransactionalSession 7.0.1 NServiceBus.TransactionalSession 2.0.2

Steps to reproduce

Clone the repo app and follow instructions for Reproduce TransactionScope issue.

Additional Information

Additional information

The issue was initially identified using the RabbitMQ transport, but was simplified to LearningTransport in the repo app.

danielmarbach commented 1 year ago

@pardahlman thanks for the detailed description and reproduction steps. We have started looking into this issue. I'll keep you posted. In the meantime I have sent a small correction PR to fix parts of the reproduction solution

https://github.com/oskar/TransactionalSessionWithOutbox/pull/1

danielmarbach commented 1 year ago

@pardahlman I have sent you a pull request against your repository that makes the transaction scope scenario work

https://github.com/oskar/TransactionalSessionWithOutbox/pull/2

the description also contains a bit of background information about the "why". As highlighted I will do some more digging because I share your expectations about "how it should behave" vs "how it behaves".

danielmarbach commented 1 year ago

I have raised the persistence counter part https://github.com/Particular/NServiceBus.Persistence.Sql/issues/1198

pardahlman commented 1 year ago

Thanks for a detailed explanation of the situation as well as showing how it works in the repo app. I see that you already has a PR in place for fixing #1198. Great and fast work 👌

danielmarbach commented 1 year ago

Hi @pardahlman . We've prioritized your issue near the top of our list and will work on it as soon as we can.

danielmarbach commented 1 year ago

This has been addressed as part of https://github.com/Particular/NServiceBus.Persistence.Sql/issues/1198

danielmarbach commented 1 year ago

@pardahlman we have released 7.0.2 and 6.6.4 to nuget (not yet announced) which fixes the transaction scope issue you raised. We will also announce it soon in the discuss group. Thanks again for the excellent reproduction sample. It helped a lot!