Refactor IEmailQueue to IOutgoingEmailQueue

Renamed the `IEmailQueue` interface to `IOutgoingEmailQueue` to improve clarity and better reflect its purpose as an outgoing email queue. Updated all references to the interface across the codebase, including:

- Replaced `IEmailQueue` with `IOutgoingEmailQueue` in `EmailSenderWorker.cs`.
- Renamed the interface in `IOutgoingEmailQueue.cs`.
- Updated `SendEmailCommandHandler` in `SendEmailCommand.cs` to use `IOutgoingEmailQueue`.
- Modified dependency injection in `DependencyInjection.cs` to register `OutgoingEmailQueue` with `IOutgoingEmailQueue`.
- Updated `OutgoingEmailQueue.cs` to implement `IOutgoingEmailQueue`.

These changes improve code readability, maintainability, and naming consistency.
This commit is contained in:
2026-07-23 16:55:52 +02:00
parent 42e9361f1d
commit 55e5d689ad
5 changed files with 5 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ namespace DigitalData.EmailProfiler.API.Workers;
/// NO database operations - email account configuration comes from appsettings.
/// </summary>
public class EmailSenderWorker(
IEmailQueue EmailQueue,
IOutgoingEmailQueue EmailQueue,
ILogger<EmailSenderWorker> Logger,
IOptions<EmailSenderWorkerConfiguration> configuration) : BackgroundService
{

View File

@@ -6,7 +6,7 @@ namespace DigitalData.EmailProfiler.Application.Common.Interfaces;
/// <summary>
/// Email queue interface for outgoing emails.
/// </summary>
public interface IEmailQueue
public interface IOutgoingEmailQueue
{
Task EnqueueAsync(OutgoingEmailEvent outgoingEmailEvent, CancellationToken cancellationToken = default);
Task<OutgoingEmailEvent?> DequeueAsync(CancellationToken cancellationToken = default);

View File

@@ -35,7 +35,7 @@ public record SendEmailCommand : IRequest<OutgoingEmailEvent>
/// Handler for SendEmailCommand
/// Creates EmailOutbox entity via AutoMapper and enqueues to RabbitMQ
/// </summary>
public class SendEmailCommandHandler(IEmailQueue EmailQueue, IMapper Mapper) : IRequestHandler<SendEmailCommand, OutgoingEmailEvent>
public class SendEmailCommandHandler(IOutgoingEmailQueue EmailQueue, IMapper Mapper) : IRequestHandler<SendEmailCommand, OutgoingEmailEvent>
{
public async Task<OutgoingEmailEvent> Handle(SendEmailCommand request, CancellationToken cancellationToken)
{

View File

@@ -31,7 +31,7 @@ public static class DependencyInjection
services.AddSingleton<IEncryptionService, DataProtectionEncryptionService>();
// --- Email Queue (RabbitMQ) ---
services.AddSingleton<IEmailQueue, OutgoingEmailQueue>();
services.AddSingleton<IOutgoingEmailQueue, OutgoingEmailQueue>();
// --- RabbitMQ Configuration ---
services.Configure<RabbitMqConfiguration>(

View File

@@ -16,7 +16,7 @@ namespace DigitalData.EmailProfiler.Infrastructure.Queue;
/// Provides message persistence, scalability, and reliability.
/// Uses Lazy<T> initialization pattern to avoid blocking constructor.
/// </summary>
public class OutgoingEmailQueue : IEmailQueue, IDisposable
public class OutgoingEmailQueue : IOutgoingEmailQueue, IDisposable
{
private readonly ILogger<OutgoingEmailQueue> _logger;
private readonly RabbitMqConfiguration _config;