-
-
Notifications
You must be signed in to change notification settings - Fork 373
Description
Hi, we are facing some problems when deferring a message when the exception was thrown after publishing another message:
public async Task Handle(InboundMessage message) //i am a rebus message handler
{
await DoWork();
await _bus.Publish(new OutboundMessage { Body = "Hello darkness my old friend" });
await DoMoreWork(); // throw error oeps!
}
public async Task Handle(IFailed<InboundMessage >message)
{
await _bus.Advanced.TransportMessage.Defer(TimeSpan.FromSeconds(5));
}
The inboundMessage is placed correctly on the DLQ after the messages has been deferred (3 times in our case).
However... the Outbound message is not rolled back. Result => inbound message on the DLQ and 3 outgoing outbound messages :(
I tried the solution from this issue #1099
This is causing another error Could net get current message context! The message context can only be resolved when handling a Rebus message, and it looks like this attempt was made from somewhere else.
This is as expected because we are creating the RebusTransactionScope inside a message handler (mentioned here: #804)
Any other solution/thoughts on this?