Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

53 rindas
1.9 KiB

  1. using DotNetCore.CAP;
  2. using DotNetCore.CAP.Internal;
  3. using Microsoft.AspNetCore.Builder;
  4. using Microsoft.AspNetCore.Hosting;
  5. using Microsoft.Extensions.DependencyInjection;
  6. using Sample.RabbitMQ.SqlServer.DispatcherPerGroup.TypedConsumers;
  7. using Serilog;
  8. namespace Sample.RabbitMQ.SqlServer.DispatcherPerGroup
  9. {
  10. public class Startup
  11. {
  12. // This method gets called by the runtime. Use this method to add services to the container.
  13. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
  14. public void ConfigureServices(IServiceCollection services)
  15. {
  16. services.AddLogging(x => x.AddSerilog());
  17. services
  18. .AddSingleton<IConsumerServiceSelector, TypedConsumerServiceSelector>()
  19. .AddQueueHandlers(typeof(Startup).Assembly);
  20. services.AddCap(options =>
  21. {
  22. options.UseSqlServer("Server=(local);Database=CAP-Test;Trusted_Connection=True;");
  23. options.UseRabbitMQ("localhost");
  24. options.UseDashboard();
  25. options.GroupNamePrefix = "th";
  26. options.ConsumerThreadCount = 1;
  27. options.UseDispatchingPerGroup = true;
  28. });
  29. services.AddControllersWithViews();
  30. }
  31. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  32. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  33. {
  34. app.UseDeveloperExceptionPage();
  35. app.UseSerilogRequestLogging();
  36. app.UseCapDashboard();
  37. app.UseRouting();
  38. app.UseEndpoints(endpoints =>
  39. {
  40. endpoints.MapControllerRoute(
  41. name: "default",
  42. pattern: "{controller=Home}/{action=Index}/{id?}");
  43. });
  44. }
  45. }
  46. }