public async Task PerformAllEventsWithExpressionTest() { Stopwatch stopwatch = new Stopwatch(); var list = await projectionContext.GetListOfOrderStreamsAsync(); var eventProcessor = new ExecuteEventProcessor(orderContext, eventContext, mappingTestConfig.Mapper) { MessageHandlerContext = new TestableMessageHandlerContext() }; stopwatch.Start(); foreach (var streamName in list.Items) { await eventProcessor.PerformEventsByStreamWithExpression(streamName, orderHandler); } stopwatch.Stop(); Debug.WriteLine(stopwatch.ElapsedMilliseconds); var time = (stopwatch.ElapsedMilliseconds / 1000) / 60; Debug.WriteLine(time); }
public RestoreCommandHandler(OrderHandler orderHandler, ExecuteEventProcessor executeEventProcessor, ProjectionProvider projectionContext, EventProvider eventContext, CustomerHandler customerHandler) { this.orderHandler = orderHandler; this.executeEventProcessor = executeEventProcessor; this.projectionContext = projectionContext; this.eventContext = eventContext; this.customerHandler = customerHandler; }
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); }