We are currently migrating from MSMQ and DTC to RabbitMQ with an MSSQL outbox. As I understand it, the only way to have the outbox and business logic share the same transaction is to get the SQL connection and SQL transaction from the
SynchronizedStorageSession and use it for business DB access. Our repository is currently registered in the IoC container, arriving to the handler as a constructor parameter. The
SynchronizedStorageSession comes as a property on
IMessageHandlerContext, that is, as a handler method parameter. Is there any way to get the
SynchronizedStorageSession (or just the connection) into the container so that we can keep using constructor dependency injection?
An alternative (and probably better solution) would be to have the outbox connection enlisted in the
TransactionScope. Is there any way to achieve this? I know about the UnitOfWork feature, but as far as I understand, the outbox will not be part of its transaction.