diff --git a/accessibility-service/src/Accessibility.Api/Options/EventBusOptions.cs b/accessibility-service/src/Accessibility.Api/Options/EventBusOptions.cs index 72ba57cc..a1a52bd0 100644 --- a/accessibility-service/src/Accessibility.Api/Options/EventBusOptions.cs +++ b/accessibility-service/src/Accessibility.Api/Options/EventBusOptions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Accessibility.Application; namespace Accessibility.Api.Options { @@ -6,15 +7,10 @@ public class EventBusOptions { public EventBusOptions() { - Exchanges = new Dictionary(); + Exchanges = new Dictionary(); } public const string EventBus = "EventBus"; - public Dictionary Exchanges { get; set; } - } - - public enum EventBusExchange - { - BookingRequests + public Dictionary Exchanges { get; set; } } } diff --git a/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommand.cs b/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommand.cs index 095eb738..161c3a22 100644 --- a/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommand.cs +++ b/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommand.cs @@ -6,7 +6,7 @@ namespace Accessibility.Application.Bookings.Commands.CreateBookingRequest { public class CreateBookingRequestCommand : IRequest { - public CreateBookingRequestCommand(Guid customerId, Guid facilityId, List bookedRecords, Dictionary eventBusExchanges) + public CreateBookingRequestCommand(Guid customerId, Guid facilityId, List bookedRecords, Dictionary eventBusExchanges) { CustomerId = customerId; FacilityId = facilityId; @@ -17,6 +17,6 @@ public CreateBookingRequestCommand(Guid customerId, Guid facilityId, List BookedRecords { get; } - public Dictionary EventBusExchanges { get; } + public Dictionary EventBusExchanges { get; } } } \ No newline at end of file diff --git a/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommandHandler.cs b/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommandHandler.cs index a2226220..59a474ca 100644 --- a/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommandHandler.cs +++ b/accessibility-service/src/Accessibility.Application/Bookings/Commands/CreateBookingRequest/CreateBookingRequestCommandHandler.cs @@ -51,7 +51,7 @@ public async Task Handle(CreateBookingRequestCommand request, Cancellation await bookingRepository.AddAsync(booking); await unitOfWork.CommitAsync(); - var sendEndpoint = await sendEndpointProvider.GetSendEndpoint(new Uri($"exchange:{request.EventBusExchanges[EventBusExchange.BookingRequests.ToString()]}")); + var sendEndpoint = await sendEndpointProvider.GetSendEndpoint(new Uri($"exchange:{request.EventBusExchanges[EventBusExchange.BookingRequests]}")); await sendEndpoint.Send(new BookingRequested( facilityId, diff --git a/accessibility-service/src/Accessibility.Infrastructure/Startup.cs b/accessibility-service/src/Accessibility.Infrastructure/Startup.cs index c6252a44..98d4faa8 100644 --- a/accessibility-service/src/Accessibility.Infrastructure/Startup.cs +++ b/accessibility-service/src/Accessibility.Infrastructure/Startup.cs @@ -35,7 +35,7 @@ namespace Accessibility.Infrastructure public static class Startup { // TODO: split registrations into modules - public static IServiceCollection ConfigureAccessibility(this IServiceCollection services, IConfiguration configuration, Assembly applicationAssembly, Dictionary eventBusExchanges) + public static IServiceCollection ConfigureAccessibility(this IServiceCollection services, IConfiguration configuration, Assembly applicationAssembly, Dictionary eventBusExchanges) { var connectionString = configuration.GetConnectionString("Accessibility"); @@ -62,7 +62,7 @@ public static IServiceCollection ConfigureAccessibility(this IServiceCollection return services; } - private static IServiceCollection ConfigureEventBus(this IServiceCollection services, IConfiguration configuration, Dictionary eventBusExchanges) + private static IServiceCollection ConfigureEventBus(this IServiceCollection services, IConfiguration configuration, Dictionary eventBusExchanges) { return services.AddMassTransit(x => { @@ -78,7 +78,7 @@ private static IServiceCollection ConfigureEventBus(this IServiceCollection serv cfgH.Password(configuration["RabbitMQ:Password"]); }); - cfg.ReceiveEndpoint(eventBusExchanges[EventBusExchange.BookingRequests.ToString()], e => + cfg.ReceiveEndpoint(eventBusExchanges[EventBusExchange.BookingRequests], e => e.ConfigureConsumer(context)); cfg.ReceiveEndpoint("offer-created-listener", e =>