Browse Source

add rabbitmq dependency in Payment.api container and IPaymentIntegrationEventService DI

pull/809/head
Christian Arenas 7 years ago
parent
commit
f025accb2a
2 changed files with 5 additions and 1 deletions
  1. +2
    -0
      docker-compose.yml
  2. +3
    -1
      src/Services/Payment/Payment.API/Startup.cs

+ 2
- 0
docker-compose.yml View File

@ -90,3 +90,5 @@ services:
build: build:
context: ./src/Services/Payment/Payment.API context: ./src/Services/Payment/Payment.API
dockerfile: Dockerfile dockerfile: Dockerfile
depends_on:
- rabbitmq

+ 3
- 1
src/Services/Payment/Payment.API/Startup.cs View File

@ -11,6 +11,7 @@ using Payment.API.IntegrationCommands.Commands;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using RabbitMQ.Client; using RabbitMQ.Client;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Payment.API.IntegrationEvents;
namespace Payment.API namespace Payment.API
{ {
@ -34,6 +35,7 @@ namespace Payment.API
// Add framework services. // Add framework services.
services.AddMvc(); services.AddMvc();
services.AddTransient<IPaymentIntegrationEventService, PaymentIntegrationEventService>();
services.AddSingleton<IRabbitMQPersistentConnection>(sp => services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
{ {
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>(); var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
@ -45,10 +47,10 @@ namespace Payment.API
return new DefaultRabbitMQPersistentConnection(factory, logger); return new DefaultRabbitMQPersistentConnection(factory, logger);
}); });
services.AddSingleton<IEventBus, EventBusRabbitMQ>(); services.AddSingleton<IEventBus, EventBusRabbitMQ>();
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>(); services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
services.AddTransient<IIntegrationEventHandler<PayOrderCommandMsg>>(); services.AddTransient<IIntegrationEventHandler<PayOrderCommandMsg>>();
services.AddSwaggerGen(); services.AddSwaggerGen();
services.ConfigureSwaggerGen(options => services.ConfigureSwaggerGen(options =>


Loading…
Cancel
Save