Example #1
0
 public CheckpointSuggestedWorkItem(
     CoreProjection projection, ProjectionMessage.Projections.CheckpointSuggested message,
     CoreProjectionCheckpointManager checkpointManager)
     : base(projection, "") // checkpoints are serialized based on string.empty token stream name
 {
     _message           = message;
     _checkpointManager = checkpointManager;
 }
 // checkpoints are serialized based on string.empty token stream name
 public CheckpointSuggestedWorkItem(
     CoreProjection projection, ProjectionMessage.Projections.CheckpointSuggested message,
     CoreProjectionCheckpointManager checkpointManager)
     : base(projection, "")
 {
     _message = message;
     _checkpointManager = checkpointManager;
 }
Example #3
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");
            }
            _projectionCorrelationId = projectionCorrelationId;
            _name                   = name;
            _projectionConfig       = projectionConfig;
            _logger                 = logger;
            _publisher              = publisher;
            _projectionStateHandler = projectionStateHandler;
            _readDispatcher         = readDispatcher;
            _writeDispatcher        = writeDispatcher;
            var builder = new CheckpointStrategy.Builder();

            _projectionStateHandler.ConfigureSourceProcessingStrategy(builder);
            _checkpointStrategy  = builder.Build(_projectionConfig.Mode);
            _eventFilter         = _checkpointStrategy.EventFilter;
            _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);
            GoToState(State.Initial);
        }
 protected virtual void When()
 {
     _manager = new MultiStreamCheckpointManager(
         _projection, _bus, _projectionCorrelationId, _readDispatcher, _writeDispatcher, _config,
         "projection", new MultiStreamPositionTagger(new[] { "a", "b" }), _projectionStateUpdatesStreamId);
 }