public async Task GetAllStreamsProjectionTest()
        {
            var projectionContext = new ProjectionProvider();

            var data = await projectionContext.GetListOfOrderStreamsAsync();

            Assert.IsNotNull(data);
        }
        private async Task RestoreOrdersAsync()
        {
            var projectionResult = await projectionContext.GetListOfOrderStreamsAsync();

            foreach (var stream in projectionResult.Items)
            {
                await executeEventProcessor.PerformEventsByStreamAsync(stream, orderHandler);
            }
        }
Пример #3
0
        public async Task PerformAllEventsTest()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            var streams = await projectionContext.GetListOfOrderStreamsAsync();

            Assert.IsNotNull(streams);
            Assert.IsTrue(streams.Items.Any());

            var eventProcessor =
                new ExecuteEventProcessor(orderContext, eventContext, mappingTestConfig.Mapper)
            {
                MessageHandlerContext = new TestableMessageHandlerContext()
            };

            stopwatch.Stop();

            var readEventsTime = stopwatch.ElapsedMilliseconds;

            Debug.WriteLine($"Read {streams.Count} events at time {readEventsTime} ms");

            stopwatch.Start();

            foreach (var streamName in streams.Items)
            {
                try
                {
                    await eventProcessor.PerformEventsByStreamAsync(streamName, orderHandler);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
            stopwatch.Stop();
            Debug.WriteLine(stopwatch.ElapsedMilliseconds);

            var time = (stopwatch.ElapsedMilliseconds / 1000) / 60;

            Debug.WriteLine(time);
        }