private void DistributeMessage(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { foreach (var subscriber in _headSubscribers.Values) { subscriber.Handle(message); } }
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)); }
public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { if (!base._eventFilter.PassesDeleteNotification(message.PositionStreamId)) { return; } var deletePosition = _positionTagger.MakeCheckpointTag(_positionTracker.LastTag, message); PublishPartitionDeleted(message.Partition, deletePosition); }
private void CacheRecentMessage(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { _lastMessages.Enqueue(new PartitionDeletedItem(message)); if (_lastMessages.Count > _eventCacheSize) { _lastMessages.Dequeue(); } var lastAvailableCommittedevent = _lastMessages.Peek(); _subscribeFromPosition = lastAvailableCommittedevent.Position; }
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; }
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)); }
public bool Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { EnsureStarted(); if (message.CorrelationId != _eventReaderId) { return(false); } ValidateEventOrder(message); CacheRecentMessage(message); DistributeMessage(message); return(true); }
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); }
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); }
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)); }
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); }
public abstract CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted);
public PartitionDeletedItem(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) : base(message.DeleteLinkOrEventPosition.Value) { Message = message; }
private void CacheRecentMessage(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { _lastMessages.Enqueue(new PartitionDeletedItem(message)); CleanUpCache(); }
public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { _receivedPartitionDeletedNotifications.Add(message); }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted) { throw new NotSupportedException(); }
public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { throw new NotSupportedException(); }