private CheckpointStrategy CreateCheckpointStrategy()
 {
     var result = new CheckpointStrategy.Builder();
     result.FromAll();
     result.AllEvents();
     return result.Build(ProjectionMode.Persistent);
 }
 public void setup()
 {
     var builder = new CheckpointStrategy.Builder();
     builder.FromStream("stream1");
     builder.AllEvents();
     _strategy = builder.Build(ProjectionConfig.GetTest());
 }
 protected CheckpointStrategy CreateCheckpointStrategy()
 {
     var result = new CheckpointStrategy.Builder();
     result.FromAll();
     result.AllEvents();
     return result.Build();
 }
 public void setup()
 {
     var builder = new CheckpointStrategy.Builder();
     builder.FromStream("stream1");
     builder.AllEvents();
     _strategy = builder.Build(ProjectionMode.Persistent);
 }
 public void it_can_be_created()
 {
     var builder = new CheckpointStrategy.Builder();
     builder.FromAll();
     builder.AllEvents();
     var cs = builder.Build(ProjectionMode.Persistent);
 }
 public void it_can_be_created()
 {
     var builder = new CheckpointStrategy.Builder();
     builder.FromAll();
     builder.AllEvents();
     var cs = builder.Build(ProjectionConfig.GetTest());
 }
Exemple #7
0
        public CoreProjection(
            string name, Guid projectionCorrelationId, IPublisher publisher,
            IProjectionStateHandler projectionStateHandler, ProjectionConfig projectionConfig,
            RequestResponseDispatcher
            <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted> readDispatcher,
            RequestResponseDispatcher <ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted> writeDispatcher,
            ILogger logger = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name == "")
            {
                throw new ArgumentException("name");
            }
            if (publisher == null)
            {
                throw new ArgumentNullException("publisher");
            }
            if (projectionStateHandler == null)
            {
                throw new ArgumentNullException("projectionStateHandler");
            }
            _projectionStateHandler  = projectionStateHandler;
            _projectionCorrelationId = projectionCorrelationId;

            var namingBuilder = new ProjectionNamesBuilder();

            _projectionStateHandler.ConfigureSourceProcessingStrategy(namingBuilder);

            _name = namingBuilder.ForceProjectionName ?? name;
            //TODO: move into name builder
            _stateStreamNamePattern = namingBuilder.StateStreamName ?? ProjectionsStreamPrefix + _name + "-{0}" + ProjectionsStateStreamSuffix;
            _stateStreamName        = namingBuilder.StateStreamName ?? ProjectionsStreamPrefix + _name + ProjectionsStateStreamSuffix;
            _projectionConfig       = projectionConfig;
            _logger          = logger;
            _publisher       = publisher;
            _readDispatcher  = readDispatcher;
            _writeDispatcher = writeDispatcher;
            var builder = new CheckpointStrategy.Builder();

            _projectionStateHandler.ConfigureSourceProcessingStrategy(builder);
            _checkpointStrategy  = builder.Build(_projectionConfig.Mode);
            _partitionStateCache = new PartitionStateCache();
            _processingQueue     = new CoreProjectionQueue(
                projectionCorrelationId, publisher, projectionConfig.PendingEventsThreshold, UpdateStatistics);
            _checkpointManager = this._checkpointStrategy.CreateCheckpointManager(
                this, projectionCorrelationId, this._publisher, this._readDispatcher,
                this._writeDispatcher, this._projectionConfig, this._name, _stateStreamName);
            GoToState(State.Initial);
        }
 private CheckpointStrategy CreateCheckpointStrategy()
 {
     var result = new CheckpointStrategy.Builder();
     if (_source != null)
     {
         _source(result);
     }
     else
     {
         result.FromAll();
         result.AllEvents();
     }
     return result.Build(ProjectionMode.Persistent);
 }
Exemple #9
0
        public CoreProjection(
            string name, Guid projectionCorrelationId, IPublisher publisher,
            IProjectionStateHandler projectionStateHandler, ProjectionConfig projectionConfig, ILogger logger = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name == "")
            {
                throw new ArgumentException("name");
            }
            if (publisher == null)
            {
                throw new ArgumentNullException("publisher");
            }
            if (projectionStateHandler == null)
            {
                throw new ArgumentNullException("projectionStateHandler");
            }
            _projectionCorrelationId = projectionCorrelationId;
            _name                   = name;
            _projectionConfig       = projectionConfig;
            _logger                 = logger;
            _publisher              = publisher;
            _projectionStateHandler = projectionStateHandler;
            _readDispatcher         =
                new RequestResponseDispatcher
                <ClientMessage.ReadEventsBackwards, ClientMessage.ReadEventsBackwardsCompleted>(
                    _publisher, v => v.CorrelationId, v => v.CorrelationId);
            _projectionCheckpointStreamId = ProjectionsStreamPrefix + _name + ProjectionCheckpointStreamSuffix;
            var builder = new CheckpointStrategy.Builder();

            _projectionStateHandler.ConfigureSourceProcessingStrategy(builder);
            _checkpointStrategy         = builder.Build(_projectionConfig.Mode);
            _eventFilter                = _checkpointStrategy.EventFilter;
            _lastProcessedEventPosition = new PositionTracker(_checkpointStrategy.PositionTagger);
            _partitionStateCache        = new PartitionStateCache();
            GoToState(State.Initial);
        }
 private CheckpointStrategy CreateCheckpointStrategy()
 {
     var result = new CheckpointStrategy.Builder();
     result.FromAll();
     result.AllEvents();
     return result.Build(ProjectionConfig.GetTest());
 }
 protected virtual CheckpointStrategy CreateCheckpointStrategy()
 {
     var result = new CheckpointStrategy.Builder();
     if (_source != null)
     {
         _source(result);
     }
     else
     {
         result.FromAll();
         result.AllEvents();
         result.SetEmitStateUpdated();
     }
     return result.Build(ProjectionConfig.GetTest());
 }
 protected virtual CheckpointStrategy CreateCheckpointStrategy()
 {
     var result = new CheckpointStrategy.Builder();
     var readerBuilder = new ReaderStrategy.Builder();
     if (_source != null)
     {
         _source(readerBuilder);
         _source(result);
     }
     else
     {
         readerBuilder.FromAll();
         readerBuilder.AllEvents();
         result.FromAll();
         result.AllEvents();
     }
     var config = ProjectionConfig.GetTest();
     return result.Build(config, null, readerBuilder.Build(new RealTimeProvider(), runAs: null));
 }