Question

I'm getting started using MassTransit and need to use the RuntimeServices to manage subscriptions and timeouts. The environment I'm installing into is an externally facing network divided up in to segments using firewalls.

Currently the application server where RuntimeServices is to be installed and the SQL Server do not have RPC ports open that would allow Distributed Transaction Coordinator (DTC) to work correctly.

The complete exception I am getting is listed below but the important part looks like it is System.Transactions.TransactionException: The operation is not valid for the state of the transaction.. I don't believe that the transaction is getting off the ground since DTC is not configured.

Although I should be able to ask for the correct ports to be opened I am reluctant to do so as I'm not that concerned about transactions for this purpose. So ideally I'd like to tell MassTransit or perhaps is it nHibernate that I don't require distributed transactions.

BTW my MS Message Queue is non-transactional.

Any help welcome with thanks, Rob

Full exception stack trace:

MassTransit.Context.ServiceBusReceiveContext-'System.Action'1[[MassTransit.IConsumeContext, MassTransit, Version=2.6.416.0, Culture=neutral, PublicKeyToken=null]]' threw an exception consuming message 'MassTransit.Context.ReceiveContext' NHibernate.Exceptions.GenericADOException: could not execute query [ select subscripti0_.CorrelationId as Correlat1_1_, subscripti0_.CurrentState as CurrentS2_1_, subscripti0_.ControlUri as ControlUri1_, subscripti0_.DataUri as DataUri1_ from dbo.SubscriptionClientSaga subscripti0_ where subscripti0_.CurrentState=? ] Name:p1 - Value:Active (State) [SQL: select subscripti0_.CorrelationId as Correlat1_1_, subscripti0_.CurrentState as CurrentS2_1_, subscripti0_.ControlUri as ControlUri1_, subscripti0_.DataUri as DataUri1_ from dbo.SubscriptionClientSaga subscripti0_ where subscripti0_.CurrentState=?] ---> System.Transactions.TransactionException: The operation is not valid for the state of the transaction. at System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) at System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) at NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.EnlistInDis tributedTransactionIfNeeded(ISessionImplementor session) at NHibernate.Impl.AbstractSessionImpl.EnlistInAmbientTransactionIfNeeded() at NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus() at NHibernate.Impl.SessionImpl.get_Batcher() at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) --- End of inner exception stack trace --- at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) ... (elided for brevity!) ...

Was it helpful?

Solution

Transactions are automatically promoted to DTC in certain cases: http://msdn.microsoft.com/en-us/library/ms131083.aspx

You definitely want to avoid that from happening - it kills the performance, options:

  • Subscription service is not resource-intensive, host its database locally.
  • Evaluate the scope used for message consumption, see if you can reduce it
  • If using MSMQ, use multicasting instead of subscription service
  • Consider using RabbitMQ instead - no subscription service required

https://groups.google.com/forum/?fromgroups#!forum/masstransit-discuss is where you can get help with MassTransit quickly.

Cheers, ET.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top