Ejemplo n.º 1
0
        public void Configure(IApplicationBuilder app,
                              IEventStoreBus eventBus,
                              IEventStoreProjections projections,
                              WebSocketHandler wsHandler,
                              VotingReadModelService readModelService,
                              ILogger <Startup> logger)
        {
            app.UseCors("CorsPolicy");
            app.UseMvc();
            app.UseSwagger();
            app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Voting API"));
            app.UseWebSockets();
            app.MapWebSocketManager("/ws", wsHandler);

            projections.CreateAsync(Projections.Voting)
            .DefaultRetryAsync()
            .Wait();

            eventBus.Subscribe(
                async(@event) =>
            {
                var snapshot = await readModelService.AddOrUpdate(@event);
                logger.LogInformation(snapshot.ToString());
                await wsHandler.SendMessageToAllAsync(snapshot);
            })
            .DefaultRetryAsync()
            .Wait();
        }
Ejemplo n.º 2
0
 public EventStore(IEventStoreDb db,
                   IEventStoreBus bus,
                   IEventStoreSerializer serializer)
 {
     this.db         = db;
     this.bus        = bus;
     this.serializer = serializer;
 }
Ejemplo n.º 3
0
 public EventStore(IEventStoreDb db, 
                   IEventStoreBus bus,
                   IEventStoreSerializer serializer)
 {
     this.db = db;
     this.bus = bus;
     this.serializer = serializer;
 }
Ejemplo n.º 4
0
 public EventStore(IEventStoreDb db,
                   IEventStoreBus bus,
                   IEventStoreSerializer serializer,
                   ILoggerFactory loggerFactory)
 {
     this.db         = db;
     this.bus        = bus;
     this.serializer = serializer;
     this.logger     = loggerFactory.GetLogger(typeof(EventStore));
 }
        public EventStoreSpecs()
        {
            this.serializer = new EventStoreSerializer(new[] { typeof(Event1), typeof(Event2) });
            this.bus        = new Mock <IEventStoreBus>().Object;

            var loggerFactoryMock = new Mock <ILoggerFactory>();

            loggerFactoryMock.Setup(x => x.GetLogger(It.IsAny <Type>()))
            .Returns(new Mock <ILogger>().Object);
            this.loggerFactory = loggerFactoryMock.Object;
        }
Ejemplo n.º 6
0
 public MessageDispatcherService(MessageHandlerFactory factory,
                                 MessageHandlerRegistry registry,
                                 AsyncMessagingOptions options,
                                 IEventStoreBus bus,
                                 ILogger <MessageDispatcherService> logger)
 {
     _bus          = bus;
     _subscription = options.Subscription;
     _registry     = registry;
     _factory      = factory;
     _logger       = logger;
 }
Ejemplo n.º 7
0
 public EventStoreSpecs()
 {
     this.serializer = new EventStoreSerializer(new[] { typeof(Event1), typeof(Event2) });
     this.bus = new Mock<IEventStoreBus>().Object;
 }
Ejemplo n.º 8
0
 public EventStoreSpecs()
 {
     this.serializer = new EventStoreSerializer(new[] { typeof(Event1), typeof(Event2) });
     this.bus        = new Mock <IEventStoreBus>().Object;
 }
Ejemplo n.º 9
0
 public EventSourcingConfigurator UsePublisher(IEventStoreBus eventStoreBus)
 {
     this.EventStoreBus = eventStoreBus;
     return(this);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Configures the custom event store bus that will be used by event store to publish aggregate events
 /// </summary>
 /// <param name="eventStoreBus"></param>
 /// <returns></returns>
 public EventSourcingConfigurator UseCustomEventStoreBus(IEventStoreBus eventStoreBus)
 {
     this.EventStoreBus = eventStoreBus;
     return(this);
 }