|
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Logging;
-
- namespace Sample.Kafka.SqlServer
- {
- public class Startup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddDbContext<AppDbContext>();
-
- services.AddCap(x =>
- {
- x.UseEntityFramework<AppDbContext>();
- x.UseKafka("192.168.1.26:9092");
- x.UseDashboard();
- x.UseDiscovery(d =>
- {
- d.DiscoveryServerHostName = "localhost";
- d.DiscoveryServerPort = 8500;
- d.CurrentNodeHostName = "localhost";
- d.CurrentNodePort = 5820;
- d.NodeName = "CAP 2号节点";
- });
- });
- services.AddSession();
- services.AddMvc();
- }
-
- public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
- {
- loggerFactory.AddConsole();
- loggerFactory.AddDebug();
-
- app.UseSession();
-
- app.UseMvc();
-
- app.UseCap();
- }
- }
- }
|