88using Microsoft . Extensions . Hosting ;
99using Microsoft . Extensions . Logging ;
1010using NetCoreKit . Infrastructure . AspNetCore . Configuration ;
11- using NetCoreKit . Infrastructure . AspNetCore . Extensions ;
1211using NetCoreKit . Infrastructure . Bus ;
13- using NetCoreKit . Infrastructure . Bus . Kafka ;
1412using NetCoreKit . Infrastructure . Bus . Redis ;
1513using NetCoreKit . Samples . SignalRNotifier . Services . Hubs ;
1614using IHostingEnvironment = Microsoft . AspNetCore . Hosting . IHostingEnvironment ;
@@ -23,12 +21,10 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
2321 {
2422 services . AddMediatR (
2523 typeof ( Startup ) ,
26- typeof ( DomainEventBus )
27- /*typeof(ProjectCreated)*/ ) ;
24+ typeof ( DomainEventBus ) ) ;
2825
2926 Mapper . Initialize ( cfg => cfg . AddProfiles ( typeof ( Startup ) ) ) ;
3027
31- // services.AddKafkaEventBus();
3228 services . AddRedisBus ( ) ;
3329 services . AddSignalR ( ) ;
3430 services . AddSingleton < IHostedService , ProjectHostService > ( ) ;
@@ -79,26 +75,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
7975 private static IServiceProvider BuildServiceProvider ( IServiceCollection services )
8076 {
8177 var resolver = services . BuildServiceProvider ( ) ;
82- var config = resolver . GetRequiredService < IConfiguration > ( ) ;
83- var env = resolver . GetRequiredService < IHostingEnvironment > ( ) ;
84- var kafkaOptions = config . GetSection ( "Kafka" ) ;
85- //if (env.IsDevelopment())
86- {
87- services . Configure < KafkaOptions > ( o => { o . Fqdn = kafkaOptions . GetValue < string > ( "FQDN" ) ; } ) ;
88- }
89- /*else
90- {
91- var serviceName = kafkaOptions
92- .GetValue("ServiceName", "kafka")
93- .Replace("-", "_")
94- .ToUpperInvariant();
95-
96- var ip = Environment.GetEnvironmentVariable($"{serviceName}_SERVICE_HOST");
97- var port = Environment.GetEnvironmentVariable($"{serviceName}_SERVICE_PORT");
98-
99- services.Configure<KafkaOptions>(o => { o.Fqdn = $"{ip}:{port}"; });
100- }*/
78+ //var config = resolver.GetRequiredService<IConfiguration>();
79+ //var env = resolver.GetRequiredService<IHostingEnvironment>();
10180
81+ // TODO: let register options here
82+ // ...
83+
10284 return resolver ;
10385 }
10486 }
0 commit comments