public EventDistributionPoint CreatePausedEventDistributionPoint( Guid distributionPointId, IPublisher publisher, IPublisher inputQueue, CheckpointTag checkpointTag) { if (_allStreams) { var distributionPoint = new TransactionFileReaderEventDistributionPoint( publisher, distributionPointId, new EventPosition(checkpointTag.CommitPosition.Value, checkpointTag.PreparePosition.Value)); return(distributionPoint); } else if (_streams != null && _streams.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); //TODO: handle if not the same return(CreatePausedStreamReaderEventDistributionPoint( distributionPointId, publisher, inputQueue, checkpointTag, streamName, resolveLinkTos: true, category: null)); } else if (_categories != null && _categories.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); return(CreatePausedStreamReaderEventDistributionPoint( distributionPointId, publisher, inputQueue, checkpointTag, streamName, resolveLinkTos: true, category: _categories.First())); } else { throw new NotSupportedException(); } }
public void Start(Guid distributionPointId, TransactionFileReaderEventDistributionPoint transactionFileReaderEventDistributionPoint) { _distributionPointId = distributionPointId; _headDistributionPoint = transactionFileReaderEventDistributionPoint; //Guid.Empty means head distribution point _headDistributionPoint.Resume(); }
public EventDistributionPoint CreatePausedEventDistributionPoint(Guid distributionPointId, IPublisher publisher, CheckpointTag checkpointTag) { if (_allStreams) { var distributionPoint = new TransactionFileReaderEventDistributionPoint( publisher, distributionPointId, new EventPosition(checkpointTag.CommitPosition.Value, checkpointTag.PreparePosition.Value)); return distributionPoint; } else if (_streams != null && _streams.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); //TODO: handle if not the same return CreatePausedStreamReaderEventDistributionPoint(distributionPointId, publisher, checkpointTag, streamName, resolveLinkTos: true, category: null); } else if (_categories != null && _categories.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); return CreatePausedStreamReaderEventDistributionPoint(distributionPointId, publisher, checkpointTag, streamName, resolveLinkTos: true, category: _categories.First()); } else throw new NotSupportedException(); }
public void Handle(ProjectionMessage.CoreService.Start message) { //TODO: do we need to clear subscribed projections here? //TODO: do we need to clear subscribed distribution points here? _stopped = false; var distibutionPointCorrelationId = Guid.NewGuid(); _headDistributionPoint = new TransactionFileReaderEventDistributionPoint( _publisher, distibutionPointCorrelationId, new EventPosition(_writerCheckpoint.Read(), -1)); _distributionPoints.Add(distibutionPointCorrelationId, _headDistributionPoint); _headingEventDistributionPoint.Start(distibutionPointCorrelationId, _headDistributionPoint); //NOTE: writing any event to avoid empty database which we don not handle properly // and write it after startAtCurrent to fill buffer _publisher.Publish( new ClientMessage.WriteEvents( Guid.NewGuid(), new NoopEnvelope(), "$temp", ExpectedVersion.Any, new Event(Guid.NewGuid(), "Starting", false, new byte[0], new byte[0]))); }
public EventDistributionPoint CreatePausedEventDistributionPoint( Guid distributionPointId, IPublisher publisher, CheckpointTag checkpointTag) { if (_allStreams && _useEventIndexes && _events != null && _events.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); return(CreatePausedStreamReaderEventDistributionPoint( distributionPointId, publisher, checkpointTag, streamName, resolveLinkTos: true)); } if (_allStreams && _useEventIndexes && _events != null && _events.Count > 1) { return(CreatePausedMultiStreamReaderEventDistributionPoint( distributionPointId, publisher, checkpointTag, resolveLinkTos: true, streams: GetEventIndexStreams())); } if (_allStreams) { var distributionPoint = new TransactionFileReaderEventDistributionPoint( publisher, distributionPointId, new EventPosition(checkpointTag.CommitPosition.Value, checkpointTag.PreparePosition.Value)); return(distributionPoint); } if (_streams != null && _streams.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); //TODO: handle if not the same return(CreatePausedStreamReaderEventDistributionPoint( distributionPointId, publisher, checkpointTag, streamName, resolveLinkTos: true)); } if (_categories != null && _categories.Count == 1) { var streamName = checkpointTag.Streams.Keys.First(); return(CreatePausedStreamReaderEventDistributionPoint( distributionPointId, publisher, checkpointTag, streamName, resolveLinkTos: true)); } if (_streams != null && _streams.Count > 1) { return(CreatePausedMultiStreamReaderEventDistributionPoint( distributionPointId, publisher, checkpointTag, resolveLinkTos: true, streams: _streams)); } throw new NotSupportedException(); }
public void Stop() { _headDistributionPoint = null; }