You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
1.2 KiB

  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.AspNetCore.Hosting;
  3. using Microsoft.Extensions.Configuration;
  4. using Microsoft.Extensions.DependencyInjection;
  5. using Microsoft.Extensions.Logging;
  6. using Sample.RabbitMQ.SqlServer;
  7. namespace Sample.Kafka.SqlServer
  8. {
  9. public class Startup
  10. {
  11. public void ConfigureServices(IServiceCollection services)
  12. {
  13. services.AddDbContext<AppDbContext>();
  14. services.AddCap(x =>
  15. {
  16. x.UseEntityFramework<AppDbContext>();
  17. x.UseKafka("192.168.2.215:9092");
  18. x.UseDashboard();
  19. //x.UseDiscovery(d =>
  20. //{
  21. // d.DiscoveryServerHostName = "localhost";
  22. // d.DiscoveryServerPort = 8500;
  23. // d.CurrentNodeHostName = "localhost";
  24. // d.CurrentNodePort = 5820;
  25. // d.NodeName = "CAP 2号节点";
  26. //});
  27. }).AddMessagePacker<MyMessagePacker>();
  28. services.AddMvc();
  29. }
  30. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  31. {
  32. app.UseMvc();
  33. app.UseCap();
  34. }
  35. }
  36. }