Exemplo n.º 1
0
        void ExecuteActionsAgainstRabbitMq(object sender, TransactionEventArgs transactionEventArgs)
        {
            var transactionInfo = transactionEventArgs.Transaction.TransactionInformation;

            if (transactionInfo.Status != TransactionStatus.Committed)
            {
                OutstandingOperations.Clear();
                return;
            }

            var transactionId = transactionInfo.LocalIdentifier;

            if (!OutstandingOperations.ContainsKey(transactionId))
            {
                return;
            }

            var actions = OutstandingOperations[transactionId];

            if (!actions.Any())
            {
                return;
            }

            ExecuteRabbitMqActions(actions);

            OutstandingOperations.Clear();
        }
Exemplo n.º 2
0
        private void CommitTransaction(object sender, TransactionEventArgs e)
        {
            var transactionInfo = e.Transaction.TransactionInformation;

            if (transactionInfo.Status != TransactionStatus.Committed)
            {
                OutstandingOperations.Clear();
                return;
            }

            var transactionId = transactionInfo.LocalIdentifier;

            if (!OutstandingOperations.ContainsKey(transactionId))
            {
                return;
            }

            var messages = OutstandingOperations[transactionId];

            if (!messages.Any())
            {
                return;
            }

            var result = connectionManager.GetConnection()
                         .AppendToStream(EndpointAddress.GetIntermediateOutgoingQueue(), ExpectedVersion.Any, messages);

            OutstandingOperations.Clear();
        }