static RootAppConfiguration LoadConfiguration() { var configurationRoot = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddEnvironmentVariables() .Build(); var configuration = new RootAppConfiguration(); configurationRoot.Bind(configuration); return(configuration); }
public void Configure(IServiceCollection services, RootAppConfiguration configuration) { AddConfiguration(services, configuration); services.AddHttpClient(); services.AddKafkaProducer(); AddUkrlpApi(services); AddUkrlpDataReceiver(services, configuration); AddState(services); services .AddScoped <IChangeProcessor, ChangeProcessor>(); }
public void Configure(IServiceCollection services, RootAppConfiguration configuration) { AddConfiguration(services, configuration); services.AddHttpClient(); services.AddKafkaProducer(); AddState(services); AddQueuing(services); AddSubmitLearnerData(services); AddSldDataReceiver(services); services .AddScoped <IChangeProcessor, ChangeProcessor>(); }
private void AddConfiguration(IServiceCollection services, RootAppConfiguration configuration) { services.AddSingleton(configuration); services.AddSingleton(configuration.SourceData); services.AddSingleton(configuration.DataServicePlatform); services.AddSingleton(configuration.State); services.AddSingleton(new KafkaBrokerConfiguration { BootstrapServers = configuration.DataServicePlatform.KafkaBootstrapServers, }); services.AddSingleton(new KafkaSchemaRegistryConfiguration { BaseUrl = configuration.DataServicePlatform.SchemaRegistryUrl, }); }
private void AddRoatpDataReceiver(IServiceCollection services, RootAppConfiguration configuration) { if (!string.IsNullOrEmpty(configuration.DataServicePlatform.KafkaBootstrapServers)) { services.AddScoped <IRoatpDataReceiver, KafkaRoatpDataReceiver>(); } else { // Having issues with Typed clients with HTTP extensions. Doing this for now services.AddScoped <IRoatpDataReceiver, KafkaRestProxyRoatpDataReceiver>(sp => { var httpClientFactory = sp.GetService <IHttpClientFactory>(); return(new KafkaRestProxyRoatpDataReceiver( httpClientFactory.CreateClient(), sp.GetService <DataServicePlatformConfiguration>(), sp.GetService <ILogger <KafkaRestProxyRoatpDataReceiver> >())); }); } }
public void Configure(IServiceCollection services, RootAppConfiguration configuration) { JsonConvert.DefaultSettings = () => new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), }; services.AddHttpClient(); services.AddKafkaProducer(); AddConfiguration(services, configuration); AddLogging(services); AddRoatpDataSource(services); AddRoatpDataReceiver(services, configuration); AddState(services); services .AddScoped <IChangeProcessor, ChangeProcessor>(); }
public TestHarness() { // Get service collection to setup var serviceCollection = new ServiceCollection(); // Create dummy configuration var configuration = new RootAppConfiguration { Queuing = new QueuingConfiguration(), State = new StateConfiguration(), SubmitLearnerData = new SubmitLearnerDataConfiguration(), DataServicePlatform = new DataServicePlatformConfiguration(), }; // Setup application var startup = new Startup(); startup.Configure(serviceCollection, configuration); SetupServiceForTestHarness(serviceCollection); // Get service provider _serviceProvider = serviceCollection.BuildServiceProvider(); }