Refactor RabbitMQ email queue into publisher/consumer
Refactored the RabbitMQ-based email queue system by splitting `OutgoingEmailQueue` into `OutgoingEmailPublisher` and `OutgoingEmailConsumer` to separate publishing and consuming responsibilities. - Introduced `IOutgoingEmailConsumer` and renamed `IOutgoingEmailQueue` to `IOutgoingEmailPublisher` for clarity. - Updated `SendEmailCommandHandler` to use the new publisher abstraction. - Added `RabbitMqConnectionFactory` to centralize RabbitMQ connection management. - Updated dependency injection to register new services. - Simplified RabbitMQ initialization logic by delegating it to `RabbitMqConnectionFactory`. - Enhanced logging for better observability. - Improved modularity and maintainability by separating concerns between message publishing and consuming.
This commit is contained in:
@@ -32,7 +32,9 @@ public static class DependencyInjection
|
||||
services.AddSingleton<IEncryptionService, DataProtectionEncryptionService>();
|
||||
|
||||
// --- Email Queue (RabbitMQ) ---
|
||||
services.AddSingleton<IOutgoingEmailQueue, OutgoingEmailQueue>();
|
||||
services.AddSingleton<IOutgoingEmailConsumer, OutgoingEmailConsumer>();
|
||||
services.AddSingleton<IOutgoingEmailPublisher, OutgoingEmailPublisher>();
|
||||
services.AddSingleton<RabbitMqConnectionFactory>();
|
||||
|
||||
// --- RabbitMQ Configuration ---
|
||||
services.Configure<RabbitMqConfiguration>(
|
||||
|
||||
Reference in New Issue
Block a user