Fix non-structured traces

This commit is contained in:
Savorboard 2019-03-14 14:43:01 +08:00
parent dd7c7d78e1
commit 2f68e5787c
3 changed files with 12 additions and 15 deletions

View File

@ -75,6 +75,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return ConnectionMultiplexer.Connect(configuration);
});
services.AddIntegrationEventHandler();
services.AddCap(options =>
{
options.UseInMemoryStorage();
@ -109,8 +110,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
}
});
RegisterEventBus(services);
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
@ -245,16 +244,17 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
app.UseAuthentication();
}
private void RegisterEventBus(IServiceCollection services)
{
services.AddTransient<ProductPriceChangedIntegrationEventHandler>();
services.AddTransient<OrderStartedIntegrationEventHandler>();
}
}
public static class CustomExtensionMethods
{
public static IServiceCollection AddIntegrationEventHandler(this IServiceCollection services)
{
services.AddTransient<ProductPriceChangedIntegrationEventHandler>();
services.AddTransient<OrderStartedIntegrationEventHandler>();
return services;
}
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
{
var hcBuilder = services.AddHealthChecks();

View File

@ -37,7 +37,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
.AddCustomMVC(Configuration)
.AddCustomDbContext(Configuration)
.AddCustomOptions(Configuration)
.AddIntegrationServices()
.AddIntegrationEventHandler()
.AddEventBus(Configuration)
.AddSwagger()
.AddCustomHealthCheck(Configuration);
@ -237,12 +237,10 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
}
public static IServiceCollection AddIntegrationServices(this IServiceCollection services)
public static IServiceCollection AddIntegrationEventHandler(this IServiceCollection services)
{
//Handlers
services.AddTransient<OrderStatusChangedToAwaitingValidationIntegrationEventHandler>(); // OrderStatusChangedToAwaitingValidationIntegrationEvent
services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>(); // OrderStatusChangedToPaidIntegrationEvent
return services;
}

View File

@ -18,7 +18,6 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Swagger;
using System;
using System.Collections.Generic;