diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index a0a95a8d7..be1f75a2b 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -75,6 +75,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API return ConnectionMultiplexer.Connect(configuration); }); + services.AddIntegrationEventHandler(); services.AddCap(options => { options.UseInMemoryStorage(); @@ -108,9 +109,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API options.DefaultGroup = Configuration["SubscriptionClientName"]; } }); - - RegisterEventBus(services); - + services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); @@ -245,16 +244,17 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API app.UseAuthentication(); } + } - private void RegisterEventBus(IServiceCollection services) + public static class CustomExtensionMethods + { + public static IServiceCollection AddIntegrationEventHandler(this IServiceCollection services) { services.AddTransient(); services.AddTransient(); - } - } + return services; + } - public static class CustomExtensionMethods - { public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration) { var hcBuilder = services.AddHealthChecks(); diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index 00f398904..2123dc193 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -37,7 +37,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API .AddCustomMVC(Configuration) .AddCustomDbContext(Configuration) .AddCustomOptions(Configuration) - .AddIntegrationServices() + .AddIntegrationEventHandler() .AddEventBus(Configuration) .AddSwagger() .AddCustomHealthCheck(Configuration); @@ -237,14 +237,12 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API } - public static IServiceCollection AddIntegrationServices(this IServiceCollection services) + public static IServiceCollection AddIntegrationEventHandler(this IServiceCollection services) { - //Handlers services.AddTransient(); // OrderStatusChangedToAwaitingValidationIntegrationEvent services.AddTransient(); // OrderStatusChangedToPaidIntegrationEvent - return services; - } + } public static IServiceCollection AddEventBus(this IServiceCollection services, IConfiguration configuration) { diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index 927caf2b0..5cb2327eb 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -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;