I have an IMessageSession
and I would like to know if it's possible to make sending/publishing messages part of a transaction? e.g. would the following work?
using (var scope = new TransactionScope())
{
// Some task that may or may not succeed
await _messageSession.Send(new Message());
scope.Complete();
}
From what I can tell the message is sent immediately, and sometimes the completion of the transaction is still happening while the message is being handled - so if it is possible then what I'm doing above is wrong.
It's part of a web page, so I don't have access to an IMessageHandlerContext
where the above code works as expected