選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

36 行
1.1 KiB

  1. using System;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.Extensions.DependencyInjection;
  5. using Microsoft.Extensions.Logging;
  6. namespace Sample.RabbitMQ.MySql
  7. {
  8. public class Startup
  9. {
  10. public void ConfigureServices(IServiceCollection services)
  11. {
  12. services.AddDbContext<AppDbContext>();
  13. services.AddCap(x =>
  14. {
  15. x.UseEntityFramework<AppDbContext>();
  16. x.UseRabbitMQ("localhost");
  17. x.UseDashboard();
  18. x.FailedRetryCount = 5;
  19. x.FailedThresholdCallback = (type, name, content) =>
  20. {
  21. Console.WriteLine($@"A message of type {type} failed after executing {x.FailedRetryCount} several times, requiring manual troubleshooting. Message name: {name}, message body: {content}");
  22. };
  23. });
  24. services.AddMvc();
  25. }
  26. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  27. {
  28. app.UseMvc();
  29. }
  30. }
  31. }