Exemplo n.º 1
0
        private async Task Load()
        {
            var eventsRead = await eventTableStoreStream.ReadEvents(Apply, version);

            version += eventsRead;
            log.LogInformation("Read {NumberOfEvents} events", eventsRead);
        }
Exemplo n.º 2
0
        public virtual async Task HandleRecivedEvent(IEventEnvelope data, StreamSequenceToken token)
        {
            using (log.BeginScope(ActorId))
            {
                if (data.EventVersion == (version + 1))
                {
                    await Dispatcher.DispatchAsync(this, data);

                    log.LogInformation("Projection recived event:{eventData}", data);
                    version++;
                }
                else
                {
                    version = +await eventTableStoreStream.ReadEvents(Apply, version);
                }

                fileStorageProvider.SaveToFile <T>(new ProjectionStoreEntity <T>(version, state), Id);
            }
        }