Exemplo n.º 1
0
        private void OnPublishChannelCreated(PublishChannelCreatedEvent publishChannelCreatedEvent)
        {
            Preconditions.CheckNotNull(publishChannelCreatedEvent.Channel, "oldModel");

            var outstandingConfirms = new List<ConfirmActions>(dictionary.Values);

            foreach (var outstandingConfirm in outstandingConfirms)
            {
                outstandingConfirm.Cancel();
                ExecutePublishWithConfirmation(
                    publishChannelCreatedEvent.Channel,
                    outstandingConfirm.PublishAction,
                    outstandingConfirm.TaskCompletionSource);
            }
            
        }
 private void OnPublishChannelCreated(PublishChannelCreatedEvent @event)
 {
     foreach (var channel in unconfirmedChannelRequests.Keys)
     {
         ConcurrentDictionary<ulong, TaskCompletionSource<object>> confirmations;
         if (!unconfirmedChannelRequests.TryRemove(channel, out confirmations))
         {
             continue;
         }
         foreach (var deliveryTag in confirmations.Keys)
         {
             TaskCompletionSource<object> confirmation;
             if (!confirmations.TryRemove(deliveryTag, out confirmation))
             {
                 continue;
             }
             confirmation.TrySetExceptionSafe(new PublishInterruptedException());
         }
     }
     unconfirmedChannelRequests.Add(@event.Channel, new ConcurrentDictionary<ulong, TaskCompletionSource<object>>());
 }