Example #1
0
        private static void InitEventsDispatcher(IApplicationSettings applicationSettings, ILog logger)
        {
            var endpoint = GetEventStoreEndpoint(applicationSettings);
            var connection = EventStoreConnection.Create(endpoint);
            connection.ConnectAsync().Wait();
            _dispatcher = new EventsDispatcher(logger, applicationSettings);

            // use MongoDB for the read model
            var factory = new MongoDbAtomicWriterFactory(applicationSettings.MongoDbConnectionString, applicationSettings.MongoDbName);

            // if you want to use SQL Server for the read model then use this factory instead
            //var factory = new SqlServerAtomicWriterFactory(applicationSettings.SqlServerConnectionString);

            // if you want to use ElasticSearch for the read model then use this factory instead
            //var factory = new ElasticSearchAtomicWriterFactory(applicationSettings.ElasticSearchBaseUrl);

            var observers = new ObserverRegistry().GetObservers(factory);
            _dispatcher.Start(connection, observers);
        }
Example #2
0
        private static void InitEventsDispatcher(IApplicationSettings applicationSettings, ILog logger)
        {
            var endpoint   = GetEventStoreEndpoint(applicationSettings);
            var connection = EventStoreConnection.Create(endpoint);

            connection.ConnectAsync().Wait();
            _dispatcher = new EventsDispatcher(logger, applicationSettings);

            // use MongoDB for the read model
            var factory = new MongoDbAtomicWriterFactory(applicationSettings.MongoDbConnectionString, applicationSettings.MongoDbName);

            // if you want to use SQL Server for the read model then use this factory instead
            //var factory = new SqlServerAtomicWriterFactory(applicationSettings.SqlServerConnectionString);

            // if you want to use ElasticSearch for the read model then use this factory instead
            //var factory = new ElasticSearchAtomicWriterFactory(applicationSettings.ElasticSearchBaseUrl);

            var observers = new ObserverRegistry().GetObservers(factory);

            _dispatcher.Start(connection, observers);
        }