.netasp.net-mvc-4rhino-servicebus

Rhino Service Bus transactions


I was able to create a test application using Rhino Service Bus and Sql Server Express. I have an MVC 4 front end that creates a message and sends it to a queue and also creates a record in my database table. I have a windows service that grabs the messages from the queue and writes to a separate database table. I want the message send/database write to be all or nothing. For example, if either the message send or the database write fail, I want to be able to roll them both back. I tried wrapping them both in a TransactionScope, but based on my tests, the messages get sent to the queue even without the scope.Complete being called.

Is this possible? If so, can someone point me in the right direction?

FYI...the queues are MSMQ transactional queues

Thanks.


Solution

  • I posted the same issue on the Rhino Service Bus Google Groups site and got a response from Oren. It turns out that RSB will work with transactions, but I was using a IOnewayBus, which does not use DTC. I made the change to use a IStartableServiceBus and everything now works as I expected.