コード例 #1
0
 private void DistributeMessage(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
 {
     foreach (var subscriber in _headSubscribers.Values)
     {
         subscriber.Handle(message);
     }
 }
コード例 #2
0
        public override CheckpointTag MakeCheckpointTag(
            CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted)
        {
            if (previous.Phase != Phase)
            {
                throw new ArgumentException(
                          string.Format("Invalid checkpoint tag phase.  Expected: {0} Was: {1}", Phase, previous.Phase));
            }

            if (partitionDeleted.DeleteEventOrLinkTargetPosition < previous.Position)
            {
                throw new InvalidOperationException(
                          string.Format(
                              "Cannot make a checkpoint tag at earlier position. '{0}' < '{1}'",
                              partitionDeleted.DeleteEventOrLinkTargetPosition, previous.Position));
            }
            var byIndex = _streams.Contains(partitionDeleted.PositionStreamId);

            //TODO: handle invalid partition deleted messages without required values
            return(byIndex
                                ? previous.UpdateEventTypeIndexPosition(
                       partitionDeleted.DeleteEventOrLinkTargetPosition.Value,
                       _streamToEventType[partitionDeleted.PositionStreamId],
                       partitionDeleted.PositionEventNumber.Value)
                                : previous.UpdateEventTypeIndexPosition(partitionDeleted.DeleteEventOrLinkTargetPosition.Value));
        }
コード例 #3
0
        public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
        {
            if (!base._eventFilter.PassesDeleteNotification(message.PositionStreamId))
            {
                return;
            }
            var deletePosition = _positionTagger.MakeCheckpointTag(_positionTracker.LastTag, message);

            PublishPartitionDeleted(message.Partition, deletePosition);
        }
コード例 #4
0
        private void CacheRecentMessage(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
        {
            _lastMessages.Enqueue(new PartitionDeletedItem(message));
            if (_lastMessages.Count > _eventCacheSize)
            {
                _lastMessages.Dequeue();
            }
            var lastAvailableCommittedevent = _lastMessages.Peek();

            _subscribeFromPosition = lastAvailableCommittedevent.Position;
        }
コード例 #5
0
 private void ValidateEventOrder(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
 {
     if (_lastEventPosition > message.DeleteLinkOrEventPosition.Value ||
         _lastDeletePosition >= message.DeleteLinkOrEventPosition.Value)
     {
         throw new InvalidOperationException(
                   string.Format(
                       "Invalid partition deleted event order.  Last: '{0}' Received: '{1}'  LastDelete: '{2}'",
                       _lastEventPosition, message.DeleteLinkOrEventPosition.Value, _lastEventPosition));
     }
     _lastDeletePosition = message.DeleteLinkOrEventPosition.Value;
 }
コード例 #6
0
        public override CheckpointTag MakeCheckpointTag(CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted)
        {
            if (previous.Phase != Phase)
            {
                throw new ArgumentException(
                          string.Format("Invalid checkpoint tag phase.  Expected: {0} Was: {1}", Phase, previous.Phase));
            }

            if (partitionDeleted.DeleteLinkOrEventPosition == null)
            {
                throw new ArgumentException("Invalid partiton deleted message. deleteEventOrLinkTargetPosition required");
            }

            return(CheckpointTag.FromPosition(previous.Phase, partitionDeleted.DeleteLinkOrEventPosition.Value));
        }
コード例 #7
0
        public bool Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
        {
            EnsureStarted();
            if (message.CorrelationId != _eventReaderId)
            {
                return(false);
            }

            ValidateEventOrder(message);


            CacheRecentMessage(message);
            DistributeMessage(message);
            return(true);
        }
コード例 #8
0
        public override CheckpointTag MakeCheckpointTag(
            CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted)
        {
            if (partitionDeleted.PreTagged == null)
            {
                throw new ArgumentException("committedEvent.PreTagged == null", "committedEvent");
            }

            if (previous.Phase != Phase)
            {
                throw new ArgumentException(
                          string.Format("Invalid checkpoint tag phase.  Expected: {0} Was: {1}", Phase, previous.Phase));
            }

            return(partitionDeleted.PreTagged);
        }
コード例 #9
0
        public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
        {
            Guid projectionId;

            if (_stopped)
            {
                return;
            }
            if (_runHeadingReader && _headingEventReader.Handle(message))
            {
                return;
            }
            if (!_eventReaderSubscriptions.TryGetValue(message.CorrelationId, out projectionId))
            {
                return; // unsubscribed
            }
            _subscriptions[projectionId].Handle(message);
        }
コード例 #10
0
        public override CheckpointTag MakeCheckpointTag(
            CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted)
        {
            if (previous.Phase != Phase)
            {
                throw new ArgumentException(
                          string.Format("Invalid checkpoint tag phase.  Expected: {0} Was: {1}", Phase, previous.Phase));
            }

            if (partitionDeleted.PositionStreamId != _stream)
            {
                throw new InvalidOperationException(
                          string.Format(
                              "Invalid stream '{0}'.  Expected stream is '{1}'", partitionDeleted.Partition, _stream));
            }

            // return ordinary checkpoint tag (suitable for fromCategory.foreachStream as well as for regular fromStream
            return(CheckpointTag.FromStreamPosition(
                       previous.Phase, partitionDeleted.PositionStreamId, partitionDeleted.PositionEventNumber.Value));
        }
コード例 #11
0
        public bool Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
        {
            EnsureStarted();
            if (message.CorrelationId != _eventReaderId)
            {
                return(false);
            }

            ValidateEventOrder(message);


            CacheRecentMessage(message);
            DistributeMessage(message);
            if (_headSubscribers.Count == 0 && !_headEventReaderPaused)
            {
                //                _headEventReader.Pause();
                //                _headEventReaderPaused = true;
            }
            return(true);
        }
コード例 #12
0
 public abstract CheckpointTag MakeCheckpointTag(
     CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted);
コード例 #13
0
 public PartitionDeletedItem(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
     : base(message.DeleteLinkOrEventPosition.Value)
 {
     Message = message;
 }
コード例 #14
0
 private void CacheRecentMessage(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
 {
     _lastMessages.Enqueue(new PartitionDeletedItem(message));
     CleanUpCache();
 }
コード例 #15
0
 public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
 {
     _receivedPartitionDeletedNotifications.Add(message);
 }
コード例 #16
0
 public override CheckpointTag MakeCheckpointTag(
     CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted)
 {
     throw new NotSupportedException();
 }
コード例 #17
0
 public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message)
 {
     throw new NotSupportedException();
 }