|
123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using DotNetCore.CAP.Messages;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.Extensions.DependencyInjection;
-
- namespace Sample.RabbitMQ.SqlServer
- {
- public class Startup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddDbContext<AppDbContext>();
-
- services.AddCap(x =>
- {
- x.UseEntityFramework<AppDbContext>();
- x.UseRabbitMQ("192.168.2.120");
- x.UseDashboard();
- x.FailedRetryCount = 5;
- x.FailedThresholdCallback = (type, msg) =>
- {
- Console.WriteLine(
- $@"A message of type {type} failed after executing {x.FailedRetryCount} several times, requiring manual troubleshooting. Message name: {msg.GetName()}");
- };
- });
-
- services.AddControllers();
- }
-
- public void Configure(IApplicationBuilder app)
- {
- app.UseRouting();
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- });
- }
- }
- }
|