public static IEventFlowOptions ConfigureElasticsearch(
     this IEventFlowOptions eventFlowOptions,
     params string[] uris)
 {
     return(eventFlowOptions
            .ConfigureElasticsearch(uris.Select(u => new Uri(u, UriKind.Absolute)).ToArray()));
 }
        public static IEventFlowOptions ConfigureElasticsearch(
            this IEventFlowOptions eventFlowOptions,
            IConnectionSettingsValues connectionSettings)
        {
            var elasticClient = new ElasticClient(connectionSettings);

            return(eventFlowOptions.ConfigureElasticsearch(() => elasticClient));
        }
        public static IEventFlowOptions ConfigureElasticsearch(
            this IEventFlowOptions eventFlowOptions,
            params Uri[] uris)
        {
            var connectionSettings = new ConnectionSettings(new StaticConnectionPool(uris))
                                     .ThrowOnElasticsearchServerExceptions()
                                     .DisablePing();

            return(eventFlowOptions
                   .ConfigureElasticsearch(connectionSettings));
        }
        public void Register(IEventFlowOptions eventFlowOptions)
        {
            //TODO: read from config
            var elasticsearchUrl = "http://localhost:9200";

            eventFlowOptions
            .ConfigureElasticsearch(elasticsearchUrl)
            .AddDefaults(typeof(ElasticsearchReadModelModule).Assembly)
            .RegisterServices(r => r.Register <BookingReadModelIndexer, BookingReadModelIndexer>())
            .UseElasticsearchReadModel <BookingReadModel>();
        }
        public static IEventFlowOptions ConfigureElasticsearch(
            this IEventFlowOptions eventFlowOptions,
            params Uri[] uris)
        {
            var connectionSettings = new ConnectionSettings(new SniffingConnectionPool(uris))
                                     .ThrowExceptions()
                                     .SniffLifeSpan(TimeSpan.FromMinutes(5))
                                     .DisablePing();

            return(eventFlowOptions
                   .ConfigureElasticsearch(connectionSettings));
        }
Example #6
0
        public void Register(IEventFlowOptions eventFlowOptions)
        {
            //TODO: read from config
            var elasticsearchUrl = "http://localhost:9200";
            var connection       = new ConnectionSettings(new Uri(elasticsearchUrl));

            connection.DisableDirectStreaming(true);

            eventFlowOptions
            .ConfigureElasticsearch(connection)
            .AddDefaults(typeof(ElasticsearchReadModelModule).Assembly)
            .RegisterServices(r =>
                              r.Register <FlightAvailabilityReadModelIndexer, FlightAvailabilityReadModelIndexer>())
            .UseElasticsearchReadModel <FlightAvailabilityReadModel>();
        }
        public override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions)
        {
            // Disable SSL certificate validation
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

            var url = Environment.GetEnvironmentVariable("ELASTICSEARCH_URL");
            if (string.IsNullOrEmpty(url))
            {
                Assert.Inconclusive("The environment variabel named 'ELASTICSEARCH_URL' isn't set. Set it to e.g. 'http://localhost:9200'");
            }

            _resolver = eventFlowOptions
                .ConfigureElasticsearch(new Uri(url))
                .UseElasticsearchReadModel<ElasticsearchTestAggregateReadModel>()
                .CreateResolver();
            _elasticClient = _resolver.Resolve<IElasticClient>();
            _readModelPopulator = _resolver.Resolve<IReadModelPopulator>();
            _readModelDescriptionProvider = _resolver.Resolve<IReadModelDescriptionProvider>();
            _readModelStore = _resolver.Resolve<IElasticsearchReadModelStore<ElasticsearchTestAggregateReadModel>>();

            return _resolver;
        }
        public override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions)
        {
            // Disable SSL certificate validation
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            var url = Environment.GetEnvironmentVariable("ELASTICSEARCH_URL");

            if (string.IsNullOrEmpty(url))
            {
                Assert.Inconclusive("The environment variabel named 'ELASTICSEARCH_URL' isn't set. Set it to e.g. 'http://localhost:9200'");
            }

            _resolver = eventFlowOptions
                        .ConfigureElasticsearch(new Uri(url))
                        .UseElasticsearchReadModel <ElasticsearchTestAggregateReadModel>()
                        .CreateResolver();
            _elasticClient                = _resolver.Resolve <IElasticClient>();
            _readModelPopulator           = _resolver.Resolve <IReadModelPopulator>();
            _readModelDescriptionProvider = _resolver.Resolve <IReadModelDescriptionProvider>();
            _readModelStore               = _resolver.Resolve <IElasticsearchReadModelStore <ElasticsearchTestAggregateReadModel> >();

            return(_resolver);
        }