We are working on a .Net application using Rhino Service Bus (2.2.1.0) in
transactional mode in order to obtain a persistent queue. We cannot use the
transaction created by Rhino Service Bus since this could cause the
transaction to be promoted to a distributed transaction, which we do not
want. We have therefore chosen to create a transaction with Suppress option
("new TransactionScope(TransactionScopeOption.Suppress)"). This is managed
by a MessageModule which starts and stops the transaction in MessageArrived
and BeforeCommit event handlers.
Our problem now is, that when an uncatched exception occurs in a consumer,
Rhino Service Bus tries to dispose its transaction scope. But we have no
handles that we can use to dispose our transaction before Rhino Service Bus
disposes its own transaction, and therefore Rhino Service Bus fails with
the following message:
2011-12-22 15:02:54 [WARN ] - [Rhino.ServiceBus.Msmq.MsmqTransport]: Failed
to dispose of transaction in error mode.
System.InvalidOperationException: TransactionScope nested incorrectly.
at System.Transactions.TransactionScope.Dispose()
at
Rhino.ServiceBus.Transport.MessageHandlingCompletion.DisposeTransactionIfNotAlreadyDisposed(Boolean
txDisposed)
A solution could of course be to surround all our logic in the consumers
with a try-finally block which ends the transaction before the exception
reaches Rhino Service Bus. But that will introduce a dependency from all
consumers to the message module holding the transaction, which we would
like to avoid. A better solution from our perspective would be if Rhino
Service Bus had a BeforeRollback/BeforeDispose event (or similar), in which
we could close our transaction before Rhino Service Bus closes its
transaction. However there does not seem to be this option.
Have you got any other ideas of a solution to this problem?
Best Regards
René
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rhino-tools-dev/-/cpZ2DyCSOYIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.