public void Handle(ReaderSubscriptionMessage.EventReaderPartitionDeleted message) { if (!base._eventFilter.DeletedNotificationPasses(message.PositionStreamId)) return; var deletePosition = _positionTagger.MakeCheckpointTag(_positionTracker.LastTag, message); PublishPartitionDeleted(message.Partition, deletePosition); }
public override bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Phase < Phase) return true; return committedEvent.Data.Position.PreparePosition > previous.PreparePosition; }
public override bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Mode_ != CheckpointTag.Mode.Position) throw new ArgumentException("Mode.Position expected", "previous"); return committedEvent.Data.Position > previous.Position; }
public override bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Mode_ != CheckpointTag.Mode.Stream) throw new ArgumentException("Mode.Stream expected", "previous"); return committedEvent.Data.PositionStreamId == _stream && committedEvent.Data.PositionSequenceNumber > previous.Streams[_stream]; }
public bool Handle(ReaderSubscriptionMessage.EventReaderIdle message) { EnsureStarted(); if (message.CorrelationId != _eventReaderId) return false; DistributeMessage(message); return true; }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (!_streams.Contains(committedEvent.Data.PositionStreamId)) throw new InvalidOperationException( string.Format("Invalid stream '{0}'", committedEvent.Data.EventStreamId)); return previous.UpdateStreamPosition( committedEvent.Data.PositionStreamId, committedEvent.Data.PositionSequenceNumber); }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Phase != Phase) throw new ArgumentException( string.Format("Invalid checkpoint tag phase. Expected: {0} Was: {1}", Phase, previous.Phase)); return CheckpointTag.FromPosition(previous.Phase, committedEvent.Data.Position); }
public override bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Phase < Phase) return true; if (previous.Mode_ != CheckpointTag.Mode.MultiStream) throw new ArgumentException("Mode.MultiStream expected", "previous"); return _streams.Contains(committedEvent.Data.PositionStreamId) && committedEvent.Data.PositionSequenceNumber > previous.Streams[committedEvent.Data.PositionStreamId]; }
public override bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (committedEvent.PreTagged == null) throw new ArgumentException("committedEvent.PreTagged == null", "committedEvent"); if (previous.Phase < Phase) return true; return committedEvent.PreTagged > previous; }
public override bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Mode_ != CheckpointTag.Mode.EventTypeIndex) throw new ArgumentException("Mode.EventTypeIndex expected", "previous"); if (committedEvent.Data.OriginalPosition.CommitPosition <= 0) throw new ArgumentException("complete TF position required", "committedEvent"); return committedEvent.Data.OriginalPosition > previous.Position; }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (committedEvent.Data.PositionStreamId != _stream) throw new InvalidOperationException( string.Format( "Invalid stream '{0}'. Expected stream is '{1}'", committedEvent.Data.EventStreamId, _stream)); return CheckpointTag.FromStreamPosition( committedEvent.Data.PositionStreamId, committedEvent.Data.PositionSequenceNumber); }
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 override CheckpointTag MakeCheckpointTag(CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionEof partitionEof) { if (partitionEof.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 partitionEof.PreTagged; }
public void Handle(ReaderSubscriptionMessage.CommittedEventDistributed message) { if (message.Data == null) throw new NotSupportedException(); ReaderSubscriptionMessage.CommittedEventDistributed existing; // ignore duplicate messages (when replaying from heading event distribution point) if (!_buffer.TryGetValue(message.Data.Position.PreparePosition, out existing)) { _buffer.Add(message.Data.Position.PreparePosition, message); var maxTimestamp = _buffer.Max(v => v.Value.Data.Timestamp); ProcessAllFor(maxTimestamp); } }
public bool Handle(ReaderSubscriptionMessage.CommittedEventDistributed message) { EnsureStarted(); if (message.CorrelationId != _eventReaderId) return false; if (message.Data == null) return true; ValidateEventOrder(message); CacheRecentMessage(message); DistributeMessage(message); return true; }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Phase != Phase) throw new ArgumentException( string.Format("Invalid checkpoint tag phase. Expected: {0} Was: {1}", Phase, previous.Phase)); if (committedEvent.Data.PositionStreamId != _catalogStream) throw new InvalidOperationException( string.Format( "Invalid catalog stream '{0}'. Expected catalog stream is '{1}'", committedEvent.Data.EventStreamId, _catalogStream)); return CheckpointTag.FromByStreamPosition( previous.Phase, "", committedEvent.Data.PositionSequenceNumber, null, -1, previous.CommitPosition.GetValueOrDefault()); }
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 override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (committedEvent.Data.OriginalPosition < previous.Position) throw new InvalidOperationException( string.Format( "Cannot make a checkpoint tag at earlier position. '{0}' < '{1}'", committedEvent.Data.OriginalPosition, previous.Position)); var byIndex = _streams.Contains(committedEvent.Data.PositionStreamId); return byIndex ? previous.UpdateEventTypeIndexPosition( committedEvent.Data.OriginalPosition, _streamToEventType[committedEvent.Data.PositionStreamId], committedEvent.Data.PositionSequenceNumber) : previous.UpdateEventTypeIndexPosition(committedEvent.Data.OriginalPosition); }
public bool Handle(ReaderSubscriptionMessage.CommittedEventDistributed message) { EnsureStarted(); if (message.CorrelationId != _eventReaderId) return false; if (message.Data == null) return true; ValidateEventOrder(message); CacheRecentMessage(message); DistributeMessage(message); if (_headSubscribers.Count == 0 && !_headEventReaderPaused) { // _headEventReader.Pause(); // _headEventReaderPaused = true; } return true; }
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 override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Phase != Phase) throw new ArgumentException( string.Format("Invalid checkpoint tag phase. Expected: {0} Was: {1}", Phase, previous.Phase)); if (committedEvent.Data.EventOrLinkTargetPosition < previous.Position) throw new InvalidOperationException( string.Format( "Cannot make a checkpoint tag at earlier position. '{0}' < '{1}'", committedEvent.Data.EventOrLinkTargetPosition, previous.Position)); var byIndex = _streams.Contains(committedEvent.Data.PositionStreamId); return byIndex ? previous.UpdateEventTypeIndexPosition( committedEvent.Data.EventOrLinkTargetPosition, _streamToEventType[committedEvent.Data.PositionStreamId], committedEvent.Data.PositionSequenceNumber) : previous.UpdateEventTypeIndexPosition(committedEvent.Data.EventOrLinkTargetPosition); }
public override CheckpointTag MakeCheckpointTag(CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted) { throw new NotSupportedException(); }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionEof partitionEof) { throw new NotImplementedException(); }
public void Handle(ReaderSubscriptionMessage.EventReaderNotAuthorized message) { _receivedNotAuthorizedNotifications.Add(message); }
public void Handle(ReaderSubscriptionMessage.EventReaderEof message) { _receivedEofNotifications.Add(message); }
public void Handle(ReaderSubscriptionMessage.CommittedEventDistributed message) { _receivedEvents.Add(message); }
public static CommittedEventReceived FromCommittedEventDistributed( ReaderSubscriptionMessage.CommittedEventDistributed message, CheckpointTag checkpointTag, string eventCategory, Guid subscriptionId, long subscriptionMessageSequenceNumber) { return new CommittedEventReceived( subscriptionId, checkpointTag, eventCategory, message.Data, message.Progress, subscriptionMessageSequenceNumber, message.Source); }
public abstract CheckpointTag MakeCheckpointTag(CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionEof partitionEof);
public abstract CheckpointTag MakeCheckpointTag(CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent);
public abstract bool IsMessageAfterCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent);