Beispiel #1
0
        protected override async Task <AmqpTransactionEnlistment> OnCreateAsync(TimeSpan timeout)
        {
            try
            {
                Controller controller = await GetController(timeout).ConfigureAwait(false);

                AmqpTransactionId = await controller.DeclareAsync().ConfigureAwait(false);

                ServiceBusEventSource.Log.TransactionDeclared(_transactionId, AmqpTransactionId);
                return(this);
            }
            catch (Exception exception)
            {
                ServiceBusEventSource.Log.TransactionInitializeException(_transactionId, exception.ToString());
                _transactionManager.RemoveEnlistment(_transactionId);
                throw;
            }
        }
        protected override async Task <AmqpTransactionEnlistment> OnCreateAsync(TimeSpan timeout)
        {
            try
            {
                FaultTolerantAmqpObject <Controller> faultTolerantController = _connectionScope.TransactionController;
                Controller controller = await faultTolerantController.GetOrCreateAsync(timeout).ConfigureAwait(false);

                AmqpTransactionId = await controller.DeclareAsync().ConfigureAwait(false);

                MessagingEventSource.Log.AmqpTransactionDeclared(_transactionId, AmqpTransactionId);
                return(this);
            }
            catch (Exception exception)
            {
                MessagingEventSource.Log.AmqpTransactionInitializeException(_transactionId, exception);
                _transactionManager.RemoveEnlistment(_transactionId);
                throw;
            }
        }