Beispiel #1
0
        public ProjectionBufferedDispatcher(DataflowOptions dataflowOptions, ProjectionBase <TState> projection)
            : base(dataflowOptions)
        {
            _buffer     = new BufferBlock <Tracked <IStream> >(dataflowOptions.ToDataflowBlockOptions(false)).ToDataflow(dataflowOptions);
            _dispatcher = new ProjectionDispatcher <TState>(dataflowOptions, projection);
            _log        = projection.Log;
            _token      = projection.CancellationToken;
            _token.Register(() => _buffer.LinkTo(DataflowBlock.NullTarget <Tracked <IStream> >().ToDataflow(dataflowOptions)));

            RegisterChild(_buffer);
        }
Beispiel #2
0
        public ProjectionFlow(DataflowOptions dataflowOptions, ProjectionBase <TState> projection)
            : base(dataflowOptions)
        {
            _projection = projection;
            _eventStore = projection.EventStore;
            _log        = projection.Log;
            _token      = projection.CancellationToken;
            _versions   = projection.Versions;

            var block = new ActionBlock <Tracked <IStream> >(Process, dataflowOptions.ToDataflowBlockOptions(true));

            RegisterChild(block);
            InputBlock = block;
        }
Beispiel #3
0
        public ProjectionDispatcher(DataflowOptions options, ProjectionBase <TState> projection)
            : base(s => s.Value.Key, options, projection.CancellationToken, projection.GetType())
        {
            _projection = projection;
            Log         = projection.Log;

            CompletionTask.ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    Log.Errors.Add(t.Exception);
                }
            });
        }