diff --git a/EnvelopeGenerator.Infrastructure.Notification/DependencyInjection.cs b/EnvelopeGenerator.Infrastructure.Notification/DependencyInjection.cs index 192c688d..77250af8 100644 --- a/EnvelopeGenerator.Infrastructure.Notification/DependencyInjection.cs +++ b/EnvelopeGenerator.Infrastructure.Notification/DependencyInjection.cs @@ -31,15 +31,14 @@ public static class DependencyInjection $"MessagingServiceApiUrl must be provided when ClientType is set to Api in the '{sectionName}' configuration section."); break; case ConsumerType.RabbitMQ: - if (options.ApiUrl is string rabbitModeApiUrl) - services.AddMessagingServiceHttpClient(opt => - { - opt.BaseAddress = new Uri(rabbitModeApiUrl); - }); - else + if (options.RabbitMQ is null) throw new InvalidOperationException( - $"Missing API URL configuration." + - $"When ClientType is set to RabbitMQ in an isolated host, Notification:ApiUrl must be provided in the '{sectionName}' configuration section."); + $"Missing RabbitMQ configuration. " + + $"When ConsumerType is set to RabbitMQ, '{sectionName}:{nameof(NotificationOptions.RabbitMQ)}' must be configured."); + + services.AddMessagingServiceClient( + configuration, + rabbitMqConnectionSectionName: $"{sectionName}:{nameof(NotificationOptions.RabbitMQ)}"); break; default: throw new InvalidOperationException(