public ActivitiesAcceptanceTestsRegistry()
        {
            var config = ConfigurationHelper.GetConfiguration <ActivitiesAcceptanceTestsConfiguration>(ServiceName, Version);

            var elasticConfig = new ElasticConfiguration()
                                .OverrideEnvironmentName("AT")
                                .UseSingleNodeConnectionPool(config.ElasticUrl)
                                .ScanForIndexMappers(typeof(ActivitiesIndexMapper).Assembly)
                                .OnRequestCompleted(r => Log.Debug(r.DebugInformation));

            if (!string.IsNullOrWhiteSpace(config.ElasticUsername) && !string.IsNullOrWhiteSpace(config.ElasticPassword))
            {
                elasticConfig.UseBasicAuthentication(config.ElasticUsername, config.ElasticPassword);
            }

            For <IActivitiesClient>().Use <ActivitiesClient>();
            For <IAzureTopicMessageBus>().Use(new AzureTopicMessageBus(config.MessageServiceBusConnectionString, ""));
            For <IElasticClient>().Use(c => c.GetInstance <IElasticClientFactory>().CreateClient()).Singleton();
            For <IElasticClientFactory>().Use(() => elasticConfig.CreateClientFactory()).Singleton();
            For <ILog>().Use(c => new NLogLogger(c.ParentType, null, null)).AlwaysUnique();
            For <IMessageServiceBusConfiguration>().Use(config);
            For <IObjectCreator>().Use <ObjectCreator>();

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
        }
Example #2
0
        public ElasticRegistry()
        {
            var config = ConfigurationHelper.GetConfiguration <ActivitiesWorkerConfiguration>(ServiceName, Version);

            var elasticConfig = new ElasticConfiguration()
                                .UseSingleNodeConnectionPool(config.ElasticUrl)
                                .ScanForIndexMappers(typeof(ActivitiesIndexMapper).Assembly)
                                .OnRequestCompleted(r => Log.Debug(r.DebugInformation));

            if (!string.IsNullOrWhiteSpace(config.ElasticUsername) && !string.IsNullOrWhiteSpace(config.ElasticPassword))
            {
                elasticConfig.UseBasicAuthentication(config.ElasticUsername, config.ElasticPassword);
            }

            For <IElasticClientFactory>().Use(() => elasticConfig.CreateClientFactory()).Singleton();
            For <IElasticClient>().Use(c => c.GetInstance <IElasticClientFactory>().CreateClient()).Singleton();
            For <ILog>().Use(c => new NLogLogger(c.ParentType, null, null)).AlwaysUnique();
            For <IElasticActivityDocumentRepository>().Use <ElasticActivityDocumentRepository>();
        }