Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

40 wiersze
1.1 KiB

  1. using System;
  2. using DotNetCore.CAP.Messages;
  3. using Microsoft.AspNetCore.Builder;
  4. using Microsoft.Extensions.DependencyInjection;
  5. namespace Sample.RabbitMQ.MySql
  6. {
  7. public class Startup
  8. {
  9. public void ConfigureServices(IServiceCollection services)
  10. {
  11. services.AddDbContext<AppDbContext>();
  12. services.AddCap(x =>
  13. {
  14. x.UseEntityFramework<AppDbContext>();
  15. x.UseRabbitMQ("192.168.2.120");
  16. x.UseDashboard();
  17. x.FailedRetryCount = 5;
  18. x.FailedThresholdCallback = (type, msg) =>
  19. {
  20. Console.WriteLine(
  21. $@"A message of type {type} failed after executing {x.FailedRetryCount} several times, requiring manual troubleshooting. Message name: {msg.GetName()}");
  22. };
  23. });
  24. services.AddControllers();
  25. }
  26. public void Configure(IApplicationBuilder app)
  27. {
  28. app.UseRouting();
  29. app.UseEndpoints(endpoints =>
  30. {
  31. endpoints.MapControllers();
  32. });
  33. }
  34. }
  35. }