|
12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Logging;
-
- namespace Sample.RabbitMQ.MySql
- {
- public class Startup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddDbContext<AppDbContext>();
-
- services.AddCap(x =>
- {
- x.UseEntityFramework<AppDbContext>();
- x.UseRabbitMQ("localhost");
- x.UseDashboard();
- x.FailedRetryCount = 5;
- x.FailedThresholdCallback = (type, name, content) =>
- {
- Console.WriteLine($@"A message of type {type} failed after executing {x.FailedRetryCount} several times, requiring manual troubleshooting. Message name: {name}, message body: {content}");
- };
- });
-
- services.AddMvc();
- }
-
- public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
- {
- app.UseMvc();
-
- app.UseCap();
- }
- }
- }
|