The Transactional Session feature can lead to a lot of uncollected messages in the outbox.
This happens, when pessimistic concurrency control is used, and no message/command/event is sent or published during the transaction. In this case, an entry is still added to the outbox during opening of the transaction. But it is never cleaned up later on, as only entries marked as dispatched are deleted.
Expected behavior
Honestly not sure, what should be expected. Maybe it is not supposed to be used in such a configuration, an we have since moved away from pessimistic concurrency for the transactional session endpoint, as there is no real value in it.
Maybe it should just be mentioned in the documentation, or better, show some warning or error during startup, if it is not supported.
Actual behavior
Messages are added to the outbox, but never cleaned up afterwards.
Describe the bug
Description
The Transactional Session feature can lead to a lot of uncollected messages in the outbox. This happens, when pessimistic concurrency control is used, and no message/command/event is sent or published during the transaction. In this case, an entry is still added to the outbox during opening of the transaction. But it is never cleaned up later on, as only entries marked as dispatched are deleted.
Expected behavior
Honestly not sure, what should be expected. Maybe it is not supposed to be used in such a configuration, an we have since moved away from pessimistic concurrency for the transactional session endpoint, as there is no real value in it. Maybe it should just be mentioned in the documentation, or better, show some warning or error during startup, if it is not supported.
Actual behavior
Messages are added to the outbox, but never cleaned up afterwards.
Versions
NServiceBus.TransactionalSession 3.2.0 NServiceBus.Persistence.Sql 8.1.0 NServiceBus.Persistence.Sql.TransactionalSession 8.1.0 NServiceBus.Extensions.Hosting 3.0.0
Steps to reproduce
Small sample application to reproduce the issue.
Relevant log output
No response
Additional Information
No response