25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using DotNetCore.CAP.Messages;
- using Microsoft.AspNetCore.Builder;
- 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 = failed =>
- {
- var logger = failed.ServiceProvider.GetService<ILogger<Startup>>();
- logger.LogError($@"A message of type {failed.MessageType} failed after executing {x.FailedRetryCount} several times,
- requiring manual troubleshooting. Message name: {failed.Message.GetName()}");
- };
- });
-
- services.AddControllers();
- }
-
- public void Configure(IApplicationBuilder app)
- {
- app.UseRouting();
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- });
- }
- }
- }
|