rebus-org / Rebus.Oracle

:bus: Oracle transport for Rebus
https://mookid.dk/category/rebus
Other
5 stars 10 forks source link

BeginTransaction or Enlist don't work on dotnet 5 #29

Open djhvscf opened 2 years ago

djhvscf commented 2 years ago

Hi @mookid8000, I hope you're doing well.

If I configure the saga storage like this:

configurer.Sagas(e => e.StoreInOracle(connectionString,
 sagaDataTable,
  sagaIndexTable, enlistInAmbientTransaction: true));

It throws System.PlatformNotSupportedException: 'Operation is not supported on this platform.'

If I configure the saga storage like this:

configurer.Sagas(e => e.StoreInOracle(connectionString,
 sagaDataTable,
  sagaIndexTable));

It throws: System.InvalidOperationException: Connection is already part of a local or a distributed transaction

How can we handle that?

mookid8000 commented 2 years ago

Could you post all of the exception details (including the stacktrace)? - that would make it clear where the exception came from.

djhvscf commented 2 years ago

Sure @mookid8000

It throws: System.InvalidOperationException: Connection is already part of a local or a distributed transaction

System.AggregateException: 3 unhandled exceptions (Connection is already part of a local or a distributed transaction) (Connection is already part of a local or a distributed transaction) (Message with ID f9cb4865-2c15-4422-a77b-dc74f8800924 and type Shopping.Core.Payments.PaymentProcessing.InternalMessages.Commands.ProcessOrderPaymentsCommand, Shopping.Core could not be dispatched to any handlers (and will not be retried under the default fail-fast settings))
 ---> System.InvalidOperationException: Connection is already part of a local or a distributed transaction
   at Oracle.ManagedDataAccess.Client.OracleConnection.BeginTransaction()
   at Rebus.Oracle.OracleFactory.Open()
   at Rebus.Oracle.Sagas.OracleSqlSagaStorage.Find(Type sagaDataType, String propertyName, Object propertyValue)
   at Rebus.Sagas.LoadSagaDataStep.TryMountSagaDataOnInvoker(HandlerInvoker sagaInvoker, Object body, String label, List`1 loadedSagaData, List`1 newlyCreatedSagaData, ITransactionContext transactionContext)
   at Rebus.Sagas.LoadSagaDataStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Auditing.Sagas.SaveSagaDataSnapshotStep.Process(IncomingStepContext context, Func`1 next)
   at Yleo.Common.Rebus.Steps.DomainServicesPipelineStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.ActivateHandlersStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.HandleRoutingSlipsStep.Process(IncomingStepContext context, Func`1 next)
   at Yleo.Common.Rebus.Steps.TransactionScopeIncomingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.Simple.FailedMessageWrapperStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Auditing.Messages.IncomingAuditingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.FleetManager.Internals.Emitters.ExceptionEmitter.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func`1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)
   --- End of inner exception stack trace ---
 ---> (Inner Exception #1) System.InvalidOperationException: Connection is already part of a local or a distributed transaction
   at Oracle.ManagedDataAccess.Client.OracleConnection.BeginTransaction()
   at Rebus.Oracle.OracleFactory.Open()
   at Rebus.Oracle.Sagas.OracleSqlSagaStorage.Find(Type sagaDataType, String propertyName, Object propertyValue)
   at Rebus.Sagas.LoadSagaDataStep.TryMountSagaDataOnInvoker(HandlerInvoker sagaInvoker, Object body, String label, List`1 loadedSagaData, List`1 newlyCreatedSagaData, ITransactionContext transactionContext)
   at Rebus.Sagas.LoadSagaDataStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Auditing.Sagas.SaveSagaDataSnapshotStep.Process(IncomingStepContext context, Func`1 next)
   at Yleo.Common.Rebus.Steps.DomainServicesPipelineStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.ActivateHandlersStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.HandleRoutingSlipsStep.Process(IncomingStepContext context, Func`1 next)
   at Yleo.Common.Rebus.Steps.TransactionScopeIncomingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.Simple.FailedMessageWrapperStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Auditing.Messages.IncomingAuditingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.FleetManager.Internals.Emitters.ExceptionEmitter.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func`1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)<---
 ---> (Inner Exception #2) Rebus.Exceptions.MessageCouldNotBeDispatchedToAnyHandlersException: Message with ID f9cb4865-2c15-4422-a77b-dc74f8800924 and type Shopping.Core.Payments.PaymentProcessing.InternalMessages.Commands.ProcessOrderPaymentsCommand, Shopping.Core could not be dispatched to any handlers (and will not be retried under the default fail-fast settings)
   at Rebus.Pipeline.Receive.DispatchIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.FleetManager.Internals.Emitters.MessageProcessingEmitter.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Handlers.Reordering.HandlerReorderingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Sagas.LoadSagaDataStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Auditing.Sagas.SaveSagaDataSnapshotStep.Process(IncomingStepContext context, Func`1 next)
   at Yleo.Common.Rebus.Steps.DomainServicesPipelineStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.ActivateHandlersStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.HandleRoutingSlipsStep.Process(IncomingStepContext context, Func`1 next)
   at Yleo.Common.Rebus.Steps.TransactionScopeIncomingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.Simple.FailedMessageWrapperStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Auditing.Messages.IncomingAuditingStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.FailFast.FailFastStep.Process(IncomingStepContext context, Func`1 next)
   at Rebus.FleetManager.Internals.Emitters.ExceptionEmitter.Process(IncomingStepContext context, Func`1 next)
   at Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(Func`1 next, String identifierToTrackMessageBy, ITransactionContext transactionContext, String messageId, String secondLevelMessageId)<---

It throwsSystem.PlatformNotSupportedException: 'Operation is not supported on this platform.'

System.AggregateException: One or more errors occurred. (Operation is not supported on this platform.) ---> Operation is not supported on this platform.\n   at Rebus.Oracle.Sagas.OracleSqlSagaStorage.Insert(ISagaData sagaData, IEnumerable`1 correlationProperties)\n   at async Rebus.FleetManager.Internals.Sagas.EmittingSagaSnapshotStorage.Insert(?)\n   at async Rebus.Sagas.LoadSagaDataStep.SaveSagaData(?)\n   at async Rebus.Sagas.LoadSagaDataStep.Process(?)\n   at async Rebus.Auditing.Sagas.SaveSagaDataSnapshotStep.Process(?)\n   at async Yleo.Common.Rebus.Steps.DomainServicesPipelineStep.Process(?)\n   at async Rebus.Pipeline.Receive.ActivateHandlersStep.Process(?)\n   at async Rebus.Pipeline.Receive.HandleRoutingSlipsStep.Process(?)\n   at async Yleo.Common.Rebus.Steps.TransactionScopeIncomingStep.Process(?)\n   at async Rebus.Retry.Simple.FailedMessageWrapperStep.Process(?)\n   at async Rebus.Pipeline.Receive.DeserializeIncomingMessageStep.Process(?)\n   at async Rebus.Auditing.Messages.IncomingAuditingStep.Process(?)\n   at async Rebus.DataBus.ClaimCheck.HydrateIncomingMessageStep.Process(?)\n   at async Rebus.Retry.FailFast.FailFastStep.Process(?)\n   at async Rebus.FleetManager.Internals.Emitters.ExceptionEmitter.Process(?)\n   at async Rebus.Retry.Simple.SimpleRetryStrategyStep.DispatchWithTrackerIdentifier(?)\n---> (Inner Exception #0) System.PlatformNotSupportedException: Operation is not supported on this platform.\n   at OracleInternal.MTS.MTSRMManager.CCPEnlistDistributedTxnToSysTxn(OracleConnectionImpl connImpl, Transaction txn, MTSTxnRM txnRM, MTSTxnBranch txnBranch)\n   at OracleInternal.MTS.MTSRMManager.CCPEnlistTransaction(OracleConnectionImpl connImpl, Transaction transaction, MTSTxnRM txnRM, MTSTxnBranch txnBranch)\n   at OracleInternal.ConnectionPool.PoolManager`3.GetEnlisted(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, OracleConnection connRefForCriteria)\n   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, OracleConnection connRefForCriteria)\n   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()\n   at Rebus.Oracle.OracleFactory.OpenRaw()\n   at Rebus.Oracle.OracleFactory.Open()\n   at Rebus.Oracle.Sagas.OracleSqlSagaStorage.Insert(ISagaData sagaData, IEnumerable`1 correlationProperties)<---\nSystem.PlatformNotSupportedException: Operation is not supported on this platform.\n   at OracleInternal.MTS.MTSRMManager.CCPEnlistDistributedTxnToSysTxn(OracleConnectionImpl connImpl, Transaction txn, MTSTxnRM txnRM, MTSTxnBranch txnBranch)\n   at OracleInternal.MTS.MTSRMManager.CCPEnlistTransaction(OracleConnectionImpl connImpl, Transaction transaction, MTSTxnRM txnRM, MTSTxnBranch txnBranch)\n   at OracleInternal.ConnectionPool.PoolManager`3.GetEnlisted(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, OracleConnection connRefForCriteria)\n   at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, OracleConnection connRefForCriteria)\n   at Oracle.ManagedDataAccess.Client.OracleConnection.Open()\n   at Rebus.Oracle.OracleFactory.OpenRaw()\n   at Rebus.Oracle.OracleFactory.Open()\n   at Rebus.Oracle.Sagas.OracleSqlSagaStorage.Insert(ISagaData sagaData, IEnumerable`1 correlationProperties)