public void Send(EventData message) { var transaction = Transaction.Current; var transactionId = transaction.TransactionInformation.LocalIdentifier; IList <EventData> messages; if (!OutstandingOperations.TryGetValue(transactionId, out messages)) { messages = new List <EventData>(); transaction.TransactionCompleted += CommitTransaction; OutstandingOperations.Add(transactionId, messages); } messages.Add(message); }
public void Add(Action <IModel> action) { var transaction = Transaction.Current; if (transaction == null) { ExecuteRabbitMqActions(new[] { action }); return; } var transactionId = transaction.TransactionInformation.LocalIdentifier; if (!OutstandingOperations.ContainsKey(transactionId)) { transaction.TransactionCompleted += ExecuteActionsAgainstRabbitMq; OutstandingOperations.Add(transactionId, new List <Action <IModel> > { action }); return; } OutstandingOperations[transactionId].Add(action); }