示例#1
0
 private void EnqueuePushedEvent(StreamSubscription subscription, RecordedEvent e)
 {
     if (Verbose)
     {
         Log.Debug($"Catch-up Subscription {SubscriptionName} to {(IsSubscribedToAll ? "<all>" : StreamId)}: event appeared ({e.EventStreamId}, {e.EventNumber}, {e.EventType}).");
     }
     if (_liveQueue.Count >= MaxPushQueueSize)
     {
         EnqueueSubscriptionDropNotification(SubscriptionDropReason.ProcessingQueueOverflow, null);
         subscription.Unsubscribe();
     }
     _liveQueue.Enqueue(e);
     if (_allowProcessing)
     {
         EnsureProcessingPushQueue();
     }
 }
示例#2
0
        internal void DropSubscription(SubscriptionDropReason reason, Exception error)
        {
            if (Interlocked.CompareExchange(ref _isDropped, 1, 0) != 0)
            {
                return;
            }
            if (Verbose)
            {
                Log.Debug("Catch-up Subscription {0} to {1}: dropping subscription, reason: {2} {3}.", SubscriptionName, IsSubscribedToAll ? "<all>" : StreamId, reason, error == null ? string.Empty : error.ToString());
            }
            StreamSubscription subscription = _subscription;

            if (subscription != null)
            {
                subscription.Unsubscribe();
            }
            Action <CatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped = _subscriptionDropped;

            if (subscriptionDropped != null)
            {
                subscriptionDropped(this, reason, error);
            }
            _stopped.Set();
        }