-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
47 lines (37 loc) · 1.36 KB
/
Copy pathProgram.cs
File metadata and controls
47 lines (37 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using CAPExample.UI;
using DotNetCore.CAP.Serialization;
using System.Text.Encodings.Web;
using System.Text.Unicode;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<AppDbContext>();
builder.Services.AddTransient<PersonHandler>();
//builder.Services.AddSingleton<ISerializer, CAPSerializer>();
builder.Services.AddCap(x =>
{
x.UseEntityFramework<AppDbContext>();
x.UseRabbitMQ("localhost");
x.UseDashboard();
x.FailedRetryCount = 5;
//x.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
//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()}");
//};
}).AddSubscribeFilter<CAPFilter>();
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();