public ReadModelListener() { var eventStore = new SqlEventStore(); _eventStreamListener = new EventStreamListener(eventStore); _eventStreamListener.RegisterEventHandler <ProductCreated>(OnProductCreated); _eventStreamListener.RegisterEventHandler <ProductQuantityChanged>(OnProductQuantityChanged); _eventStreamListener.RegisterEventHandler <ProductReserved>(OnProductReserved); _eventStreamListener.RegisterEventHandler <ProductReservationCancelled>(OnProductReservationCancelled); _eventStreamListener.RegisterEventHandler <ReservedProductPurchased>(OnResrvedProductPurchased); }
public ReadModelListener() { var eventStore = new SqlEventStore(); _eventStreamListener = new EventStreamListener(eventStore); _eventStreamListener.RegisterEventHandler <OrderCreated>(OnOrderCreated); _eventStreamListener.RegisterEventHandler <OrderLineAdded>(OnOrderLineAdded); _eventStreamListener.RegisterEventHandler <OrderReadyForShipping>(OnOrderReadyForShipping); _eventStreamListener.RegisterEventHandler <OrderCancelled>(OnOrderCancelled); _eventStreamListener.RegisterEventHandler <OrderShipped>(OnOrderShipped); _eventStreamListener.RegisterEventHandler <OrderDelivered>(OnOrderDelivered); }
public void When_HandlerIsRegistered_CallsHandler() { var state = 0; var eventStore = new TestEventStore(); eventStore.AddPreviousEvents(new List <Tuple <Type, IEvent> > { new Tuple <Type, IEvent>(typeof(AggregateBase), new SomeEvent(Guid.NewGuid())) }); var eventListener = new EventStreamListener(eventStore); eventListener.RegisterEventHandler <SomeEvent>(evt => { state = 2; }); eventListener.ReadAndHandleLatestEvents <AggregateBase>(0); Assert.True(state == 2); }
public EventListener() { var eventStore = new SqlEventStore(); _eventStreamListener = new EventStreamListener(eventStore); _processManagerRepository = new ProcessManagerRepository(eventStore, eventStore); _orderProcessEventHandler = new OrderProcessEventHandler(_processManagerRepository); _eventStreamListener.RegisterEventHandler <BasketCheckedOut>(OnBasketCheckedOut); _eventStreamListener.RegisterEventHandler <ProductReserved>(OnProductReserved); _eventStreamListener.RegisterEventHandler <ProductReservationFailed>(OnProductReservationFailed); _eventStreamListener.RegisterEventHandler <OrderCreated>(OnOrderCreated); _eventStreamListener.RegisterEventHandler <OrderCancelled>(OnOrderCancelled); _eventStreamListener.RegisterEventHandler <CreateOrderFailed>(OnCreateOrderFailed); _eventStreamListener.RegisterEventHandler <OrderDelivered>(OnOrderDelivered); _eventStreamListener.RegisterEventHandler <OrderShipped>(OnOrderShipped); }