public EventStoreSubscription(IEventStoreConnection conn, EventStoreOptions options, EventDeserializer eventDeserializer, IEventStoreProjections projections)
 {
     _conn              = conn;
     _options           = options;
     _eventDeserializer = eventDeserializer;
     _projections       = projections;
 }
Beispiel #2
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();
        }
Beispiel #3
0
 public QuizController(IRepository quizRepository, IEventStoreProjections projectionsClient)
 {
     _quizRepository    = quizRepository;
     _projectionsClient = projectionsClient;
 }
 public FunnyFactsController(IEventStoreProjections projections) : base()
 {
     _projections = projections;
 }