|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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.2.227:9091,192.168.2.227:9092,192.168.2.222:9092");
- x.UseDashboard();
- x.UseDiscovery(d =>
- {
- d.DiscoveryServerHostName = "localhost";
- d.DiscoveryServerProt = 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();
-
- app.UseCapDashboard();
- }
- }
- }
|