Ejemplo n.º 1
0
        public ProjectionAgent(DocumentStore store, IAsyncProjectionShard projectionShard, ILogger logger, CancellationToken cancellation)
        {
            if (cancellation == CancellationToken.None)
            {
                _cancellationSource = new CancellationTokenSource();
                _cancellation       = _cancellationSource.Token;
            }

            _store           = store;
            _projectionShard = projectionShard;
            _logger          = logger;
            _cancellation    = cancellation;

            _controller =
                new ProjectionController(projectionShard.Name, this, projectionShard.Options);
        }
Ejemplo n.º 2
0
        // ReSharper disable once ContextualLoggerProblem
        public ProjectionAgent(DocumentStore store, IAsyncProjectionShard projectionShard, ILogger <IProjection> logger)
        {
            _store           = store;
            _projectionShard = projectionShard;
            _logger          = logger;

            var singleFile = new ExecutionDataflowBlockOptions
            {
                EnsureOrdered          = true,
                MaxDegreeOfParallelism = 1,
                CancellationToken      = _cancellationSource.Token
            };

            _commandBlock = new ActionBlock <Command>(processCommand, singleFile);

            _controller =
                new ProjectionController(projectionShard.ProjectionOrShardName, this, projectionShard.Options);

            _loader = new TransformBlock <EventRange, EventRange>(loadEvents, singleFile);
        }