Closed blundell89 closed 2 months ago
Rebus.SqlServer 8.1.2 (which is on NuGet.org now) handles the "outbox-messages-from-1st-level-handler-followed-by-2nd-level-retries" scenario explicitly. This way, using the outbox works the same way as Rebus without an outbox, where it will internally ensure that outgoing messages sent from a failing 1st level handler will not be sent.
BUT it should still be noted that Rebus' message transaction context gets committed, if the 2nd level handler executes successfully! This will have the effect that database operations performed by the 1st level handler will be committed to SQL Server if the 2nd level handler succeeds, even if the 1st level handler fails... and this is maybe not what you want/expect, so I recommend that outbox+2nd level retries are used together with caution.
As I see it, the only way this could be fixed, is by changing the way 2nd level retries work – instead of dispatching as IFailed
Hi there,
When using the Outbox feature with second-level retries, we have observed that there is a behaviour change between v7 and v8.
Let's say we have a message handler invoked. This handler writes to the database using the Rebus transaction, and then the handler throws an exception. The second-level retry handler is then invoked and succeeds.
In v7, the first level handler would rollback the database write, whereas in v8 the write from the 1st level handler is committed.
Sample