Beispiel #1
0
        public async Task ExecutePage(EventPage page, CancellationToken cancellation)
        {
            // TODO -- track the From and To, make sure we don't have any gaps. From would need to be equal to Last

            await _projection.ApplyAsync(_session, page.Streams, cancellation).ConfigureAwait(false);

            // TODO -- do something to mark the progress of the staged event options

            await _session.SaveChangesAsync(cancellation).ConfigureAwait(false);
        }
Beispiel #2
0
        public Task ApplyEvents(ProjectionUpdateBatch batch, IProjection projection, DocumentStore store,
                                CancellationToken cancellationToken)
        {
            return(Task.Run(async() =>
            {
                await using var operations = new ProjectionDocumentSession(store, _tenant, batch);

                await projection.ApplyAsync(operations, _actions, cancellationToken);
            }, cancellationToken));
        }
Beispiel #3
0
        private async Task executePage(EventPage page, CancellationToken cancellation)
        {
            using (var session = _store.OpenSession())
            {
                await _projection.ApplyAsync(session, page.Streams, cancellation).ConfigureAwait(false);

                session.QueueOperation(new EventProgressWrite(_events, _projection.Produces.FullName, page.To));

                await session.SaveChangesAsync(cancellation).ConfigureAwait(false);

                _logger.PageExecuted(page, this);

                LastEncountered = page.To;

                evaluateWaiters();

                UpdateBlock?.Post(new StoreProgress(_projection.Produces, page));
            }
        }
Beispiel #4
0
        private async Task executePage(EventPage page, CancellationToken cancellation)
        {
            // TODO -- have to pass in the tenant here
            using (var session = _store.OpenSession())
            {
                await _projection.ApplyAsync(session, page, cancellation).ConfigureAwait(false);

                session.QueueOperation(new EventProgressWrite(_events, _projection.ProjectedType().FullName, page.To));

                await session.SaveChangesAsync(cancellation).ConfigureAwait(false);

                _logger.PageExecuted(page, this);

                // This is a change to accomodate the big gap problem
                LastEncountered = page.LastEncountered();

                evaluateWaiters();

                UpdateBlock?.Post(new StoreProgress(_projection.ProjectedType(), page));
            }
        }
Beispiel #5
0
 public Task ApplyAsync(IDocumentSession session, IReadOnlyList <StreamAction> streams, CancellationToken cancellation)
 {
     return(_inner.ApplyAsync(session, new EventPage(streams.Select(x => x.ShimForOldProjections()).ToArray()), cancellation));
 }
 public async Task ApplyEvents(ProjectionUpdateBatch batch, IProjection projection, DocumentStore store,
                               CancellationToken cancellationToken)
 {
     await using var operations = new ProjectionDocumentSession(store, batch, new SessionOptions { Tracking = DocumentTracking.None, Tenant = _tenant });
     await projection.ApplyAsync(operations, _actions, cancellationToken).ConfigureAwait(false);
 }