|
|
@ -16,31 +16,21 @@ builder.Services.AddTransient<IIdentityService, IdentityService>(); |
|
|
|
|
|
|
|
var app = builder.Build(); |
|
|
|
|
|
|
|
try |
|
|
|
if (!await app.CheckHealthAsync()) |
|
|
|
{ |
|
|
|
if (!await app.CheckHealthAsync()) |
|
|
|
{ |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
app.UseServiceDefaults(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
app.MapGet("/", () => Results.Redirect("/swagger")); |
|
|
|
app.UseServiceDefaults(); |
|
|
|
|
|
|
|
app.MapGrpcService<BasketService>(); |
|
|
|
app.MapControllers(); |
|
|
|
app.MapGet("/", () => Results.Redirect("/swagger")); |
|
|
|
|
|
|
|
var eventBus = app.Services.GetRequiredService<IEventBus>(); |
|
|
|
app.MapGrpcService<BasketService>(); |
|
|
|
app.MapControllers(); |
|
|
|
|
|
|
|
eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>(); |
|
|
|
eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>(); |
|
|
|
var eventBus = app.Services.GetRequiredService<IEventBus>(); |
|
|
|
|
|
|
|
await app.RunAsync(); |
|
|
|
eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>(); |
|
|
|
eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
app.Logger.LogCritical(ex, "Program terminated unexpectedly"); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
await app.RunAsync(); |