Commit Graph

111 Commits

Author SHA1 Message Date
e6df623538 Update project version to 1.0.0 stable release
The `<Version>` tag in the `DigitalData.MessagingService.Client.csproj` file was updated from `1.0.0-beta` to `1.0.0`. This marks the transition from a beta release to a stable release, indicating the software is now ready for general use.
2026-07-29 14:49:56 +02:00
7773c8aa7f Update OnReconnect docs and README examples
Updated XML documentation in `OnReconnect.cs` to reference the updated `EmailSender.ConnectRabbitMq` method signature, clarifying its behavior when a connection is already established.

Revised `README.md` examples to replace `OutgoingEmailEvent` with `Email` and removed `Id` and `QueuedAt` properties, as they are now set internally. Added a note to clarify required fields for the `Email` object.

Added a new section to the `README.md` demonstrating how to check the connection status using `EmailSender.IsConnected`.
2026-07-29 14:36:47 +02:00
c73d8d8f36 Refactor EmailSender to use new Email abstraction
Introduced a new `Email` record to simplify the representation of outgoing email messages. Updated the `EmailSender.Send` method to accept `Email` instead of `OutgoingEmailEvent`, with a `ToEvent()` method handling the conversion internally.

Refactored test cases to use the `Email` record, removing redundant properties (`Id` and `QueuedAt`) that are now auto-generated. Updated XML documentation to reflect these changes. Adjusted namespaces and added necessary `using` directives for proper referencing.

These changes improve code readability, maintainability, and centralize the mapping logic for outgoing email events.
2026-07-29 14:36:10 +02:00
2f39db94ca Refactor and add OutgoingEmailCreateDto record
Introduced a new namespace `DigitalData.MessagingService.Publisher.Abstraction` in `OutgoingEmailCreateDto.cs` and `OutgoingEmailEvent.cs`.

Added a new record `OutgoingEmailCreateDto` with properties for recipient, subject, body, HTML flag, and queue timestamp.

Converted `OutgoingEmailEvent` from a class to a record.

Removed the unnecessary `using System;` directive from `OutgoingEmailEvent.cs`.
2026-07-29 13:43:21 +02:00
e78ceb522c Enhance logging and update solution structure
Replaced `DigitalData.MessagingService.Client.DependencyInjection`
with `DigitalData.MessagingService.Client` in the solution file,
updating project references and build configurations.

Improved logging by integrating Serilog's SQLite sink and `Serilog.UI`
for web-based log visualization. Added dynamic log directory
resolution and SQLite-based log storage in `Program.cs`.

Enhanced `DigitalData.MessagingService.API.csproj` with metadata
properties for better documentation and packaging. Added new NuGet
dependencies for logging and removed unused `<Folder>` entries.

Updated `appsettings.json` to include `Application:LogDirectory`
and `Swagger:Enabled` settings for configurable logging and Swagger
availability.
2026-07-29 13:08:42 +02:00
d7878d8ff8 Refactor namespace and project structure
Replaced `DigitalData.MessagingService.Client.DependencyInjection`
namespace with `DigitalData.MessagingService.Client` across the
codebase to simplify and streamline the project structure.

Removed unused `Microsoft.Extensions.Logging` and `System`
dependencies from `EmailSender.cs`. Updated project references
in `DigitalData.MessagingService.Tests.csproj` to reflect the
namespace and project restructuring. Adjusted `using` directives
in test files to align with the new namespace.
2026-07-29 12:35:57 +02:00
868c447a6c Add README for DigitalData.MessagingService.Client
Introduce a comprehensive README.md for the `DigitalData.MessagingService.Client` library. The README provides detailed instructions for installation, usage, and configuration, including:

- Installation via NuGet.
- Quickstart guide for connecting to RabbitMQ, sending emails, and checking connection status.
- Explanation of RabbitMQ URL format and server details.
- Prerequisites for .NET versions and RabbitMQ setup.
- Advanced configuration options for custom exchange, queue, and routing key names.
- Error handling documentation for common scenarios.
- Licensing information for Digital Data GmbH.
2026-07-29 11:20:33 +02:00
220d3f441f Add RabbitMQ integration tests and URL parsing logic
Enhanced test coverage for RabbitMQ integration by adding:
- New package references for dependency injection, logging, and RabbitMQ.
- `EmailSenderCollection` and `EmailSenderFixture` for managing static client lifecycle in integration tests.
- Integration tests for `EmailSender` and `OutgoingEmailPublisher` to verify connection management, message publishing, and serialization.
- `EmailSenderUrlOverloadTests` to validate URL-based connection overload behavior.
- `RabbitMqTestConfig` for centralized RabbitMQ test configuration.
- Unit tests for URL parsing logic in `EmailSenderUrlParsingTests`.

These changes improve reliability, maintainability, and test coverage for the messaging service.
2026-07-29 11:02:21 +02:00
5d9197f54a Update DI packages and enhance logging support
Updated `Microsoft.Extensions.DependencyInjection` to version 10.0.10 and added `Microsoft.Extensions.Logging` as a new dependency. Updated `EmailSender.cs` to include logging support by registering logging services in the DI container. Modified XML documentation to reflect the new `ConnectRabbitMq(Action<RabbitMqConfiguration>, OnReconnect)` method signature. Updated exception documentation to align with the new method signature.
2026-07-29 11:01:45 +02:00
6183ea613f Add ConnectRabbitMq method to EmailSender class
Introduce a new static method `ConnectRabbitMq` in the `EmailSender` class to configure and establish RabbitMQ connections using a URL, username, and password. The method extracts connection details (host, port, virtual host) from the URL and supports optional behavior for reconnection scenarios via the `onReconnect` parameter. Added `using System;` to support the `Uri` class.
2026-07-28 17:26:23 +02:00
e68fa989e1 Add defaults and docs to RabbitMqConfiguration properties
Updated the `RabbitMqConfiguration` class to include:
- XML documentation for all properties, improving clarity.
- Default values for `QueueName`, `ExchangeName`, `RoutingKey`,
  `DlqQueueName`, `DlqExchangeName`, and `DlqRoutingKey` to define
  RabbitMQ naming conventions.
Replaced undocumented properties with documented versions to enhance
code readability and maintainability.
2026-07-28 15:54:38 +02:00
de44b1967f Remove unused project references from test project 2026-07-28 14:33:51 +02:00
6eebfed97e Add EmailSender static client with lazy-initialized DI container
- Add EmailSender class with ConnectRabbitMq and Send methods
- Add OnReconnect enum for reconnection behavior control
- Add required NuGet packages (DependencyInjection, Hosting.Abstractions)
- Add project references to Publisher.Abstraction and Publisher
2026-07-28 14:33:47 +02:00
e8359abafd Simplify Publisher DI by removing Configuration wrapper class 2026-07-28 14:33:41 +02:00
a38e8f9680 Add Action<RabbitMqConfiguration> overload to RabbitMQ DI registration 2026-07-28 14:33:36 +02:00
7f55d97352 Refactor email publisher integration
Replaced direct registration of `OutgoingEmailPublisher` with `AddMessagingServicePublisher()` to centralize publisher setup. Removed `OutgoingEmailPublisher.cs` and its dependencies, indicating a shift to a new implementation. Updated `DependencyInjection.cs` to use `DigitalData.MessagingService.Publisher` instead of the abstraction layer. Added a project reference to `DigitalData.MessagingService.Publisher` in the infrastructure project file.
2026-07-28 11:14:42 +02:00
472c9506f9 Add RabbitMQ-based email publisher and DI support
Introduced `OutgoingEmailPublisher` for RabbitMQ-based email
queueing with message persistence, scalability, and reliability.
Added dependency injection support via `AddMessagingServicePublisher`
extension method. Enhanced RabbitMQ topology setup with exchanges,
queues, and Dead Letter Queues (DLQ).

Updated `DigitalData.MessagingService.Publisher.csproj` and
`DigitalData.MessagingService.RabbitMQ.csproj` to support
`net462`, `net480`, and `net8.0`. Added project references
and conditional package references for compatibility.

Integrated logging with `Microsoft.Extensions.Logging` and
used `System.Text.Json` for serialization. Implemented lazy
initialization for RabbitMQ channels to improve performance.
2026-07-28 11:06:16 +02:00
47f4553986 Refactor project structure and update dependencies
Reorganized project structure by introducing `core` and
`infrastructure` directories:
- Moved `Application` and `Domain` projects to `core`.
- Moved `Infrastructure` project to `infrastructure`.

Updated project references in `API`, `Infrastructure`, and
`Application` projects to reflect the new directory structure.

Added a new dependency on `Publisher.Abstraction` in the
`Application` project.
2026-07-28 10:49:32 +02:00
61c6e34b2d Add DigitalData.MessagingService.Publisher project
A new project, `DigitalData.MessagingService.Publisher`, has been added to the solution. The solution file (`DigitalData.MessagingService.sln`) was updated to include the project declaration, build configurations, and nesting under the appropriate parent project.

The new project targets `.NET 8.0` and includes the following configurations:
- Implicit Usings enabled.
- Nullable reference types enabled.
- Latest C# language version specified.
2026-07-28 10:40:55 +02:00
ac4682575c Enable implicit usings in project files
Added `<ImplicitUsings>` property with the value `enable` to both `DigitalData.MessagingService.Publisher.Abstraction.csproj` and `DigitalData.MessagingService.Client.DependencyInjection.csproj` to enable implicit global using directives. Adjusted the order of `<LangVersion>` to follow `<Nullable>` for consistency.
2026-07-28 10:40:21 +02:00
cd221e710e Add new Client Dependency Injection project
A new project, `DigitalData.MessagingService.Client.DependencyInjection`, has been added to the solution.

- Updated `DigitalData.MessagingService.sln` to include the new project with its build configurations and nested project structure.
- Created `DigitalData.MessagingService.Client.DependencyInjection.csproj` targeting `net462`, `net480`, and `net8.0`.
- Added project metadata such as `PackageId`, `Authors`, `Version`, and more.
- Included a dependency on `RabbitMQ.Client` (v7.2.1).
- Configured nullable reference types and set the language version to `latest`.
- Added `icon.png` for NuGet packaging and enabled XML documentation generation.
2026-07-28 10:30:18 +02:00
78c82bf129 Refactor solution structure and add RabbitMQ config
Reorganized the solution structure to align with a layered architecture:
- Replaced `src` folder with `core`, `infrastructure`, and `presentation`.
- Moved projects to their respective folders.
- Added `DigitalData.MessagingService.Publisher.Abstraction` project.
- Removed `DigitalData.MessagingService.Client` project.

Updated project configurations and nesting in the solution file.

Added `appsettings.Secrets.json` with RabbitMQ and email account settings:
- RabbitMQ configuration includes hostname, port, credentials, and queue/exchange details.
- Email configuration includes SMTP server details and credentials.
2026-07-28 10:26:15 +02:00
2ad2dc6b4d Remove unused projects and simplify solution structure
The following projects were removed:
- `DigitalData.MessagingService.Client.Infrastructure`
- `DigitalData.MessagingService.Client`
- `DigitalData.MessagingService.Publisher.Abstraction`

The solution file (`DigitalData.MessagingService.sln`) was updated to remove references to these projects, including solution configuration platforms and nested project sections.

Additionally, the `DigitalData.MessagingService.Application.csproj` file was updated to remove a `ProjectReference` to `DigitalData.MessagingService.Publisher.Abstraction.csproj`.

These changes streamline the solution by removing unused or redundant components and reducing dependencies.
2026-07-28 10:21:07 +02:00
3149bb1cf9 Add Publisher.Abstraction project and refactor namespaces
Introduced a new project, `DigitalData.MessagingService.Publisher.Abstraction`, to encapsulate the `OutgoingEmailEvent` class and `IOutgoingEmailPublisher` interface. The project targets multiple frameworks (`net462`, `net480`, `net8.0`) and enables nullable reference types and the latest C# language version.

Moved `OutgoingEmailEvent` and `IOutgoingEmailPublisher` to the new project, updating their namespaces and replacing `required` properties with mutable ones in `OutgoingEmailEvent`. Updated all dependent files to reference the new namespace.

Updated the solution file to include the new project and adjusted build configurations. Cleaned up unused `using` directives and removed redundant `LangVersion` property in the new project file.
2026-07-28 10:18:54 +02:00
0b3ff7cae9 Add new Client.Infrastructure project to solution
A new project, `DigitalData.MessagingService.Client.Infrastructure`, has been added to the solution. This project targets `net462` and `net8.0`, with Implicit Usings, Nullable reference types, and the latest C# language version enabled. It includes dependencies on `Microsoft.Extensions.Logging.Abstractions`, `RabbitMQ.Client`, and `Microsoft.Extensions.Options.ConfigurationExtensions`.

The solution file has been updated to include the new project, along with its build configurations (Debug and Release for Any CPU). The project hierarchy has also been updated to reflect the addition of the new project and the reassignment of the `DigitalData.MessagingService.Client` project to a different parent group.
2026-07-28 09:40:37 +02:00
977a20fd97 Refactor RabbitMQ DI into extension method
Refactored the registration of `RabbitMqConnectionFactory` and
RabbitMQ configuration into a new `AddRabbitMqConnectionFactory`
extension method for improved modularity and reusability.

- Removed direct calls to `AddSingleton<RabbitMqConnectionFactory>`
  and `Configure<RabbitMqConfiguration>` from the main
  `DependencyInjection` class.
- Added a new static `DependencyInjection` class under the
  `DigitalData.MessagingService.RabbitMQ` namespace.
- The new `AddRabbitMqConnectionFactory` method encapsulates
  RabbitMQ DI logic and accepts `IServiceCollection` and
  `IConfiguration` as parameters.
- Updated `DependencyInjection.cs` to use the new extension method.
2026-07-27 17:10:45 +02:00
56ac720615 Add net480 target, enable nullable, and set LangVersion
Updated the `<TargetFrameworks>` property to include `net480`
to support .NET Framework 4.8. Added `<LangVersion>` set to
`latest` to use the latest C# language features. Enabled
nullable reference types by adding `<Nullable>` set to
`enable` for improved null safety.
2026-07-27 17:06:50 +02:00
becb608331 Make OutgoingEmailConsumer more robust and maintainable
- Added null-safety checks (`?.`) for `ILogger` usage in `OutgoingEmailConsumer`.
- Removed unused `AsyncEventingBasicConsumer` and `_lazyInit` fields.
- Updated `DisposeAsync` to check `_lazyChannel.IsValueCreated` before accessing it.
- Added infinite delay in `AsyncInitWorker` to keep the background service active until cancellation.
- Improved overall maintainability and reduced potential runtime issues.
2026-07-27 16:55:31 +02:00
37009b8e1e Update target frameworks and enable latest C# features
Updated the project to target .NET 8.0 alongside .NET Framework 4.6.2.
Added `<LangVersion>` property set to `latest` to enable the use of
the latest C# language features. Existing `<ImplicitUsings>` and
`<Nullable>` properties remain unchanged. No changes were made to
the `MediatR` package reference.
2026-07-27 16:45:03 +02:00
b2d478c335 Refactor OutgoingEmailConsumer for better initialization
Refactored the `OutgoingEmailConsumer` class to improve maintainability, readability, and robustness. Changed the class to explicitly inherit from `IAsyncDisposable` and introduced lazy initialization for RabbitMQ connections and consumers via `_lazyInit`.

Enhanced error handling in `consumer.ReceivedAsync` by adding detailed logging, `BasicNack` for invalid messages, and placeholders for error reporting strategies. Improved logging for consumer startup and added safeguards against multiple initializations.

Removed outdated comments, updated documentation, and ensured proper resource cleanup in `DisposeAsync`.
2026-07-27 16:32:34 +02:00
bf06b31656 Support multi-targeting and reformat exception classes
Updated the project file to support multi-targeting for both
.NET Framework 4.6.2 and .NET 8.0 by replacing `<TargetFramework>`
with `<TargetFrameworks>`.

Reformatted `AuthenticationFailedException` and
`NotFoundException` classes to use braces `{ }` for namespaces
and constructors for consistency. No functional changes were made
to the exception classes.
2026-07-27 15:40:52 +02:00
77e7c796fa Refactor domain model and exception handling
Significantly restructured the `DigitalData.MessagingService.Domain` project by removing unused domain-specific classes, enums, and value objects. Key changes include:

- Updated `ExceptionHandlingMiddleware` to handle `FluentValidation.ValidationException` with formatted validation errors mapped to `HttpStatusCode.BadRequest`.
- Removed foundational domain classes such as `BaseEntity`, `ValueObject`, and `IAggregateRoot`.
- Deleted enums (`AttachmentStatus`, `AuthenticationType`, `EmailStatus`, `ErrorCode`, `ProcessType`) and domain exceptions (`DomainException`, `AttachmentProcessingException`, `DmsNotAvailableException`, `InvalidPdfException`, `ValidationException`).
- Removed value objects (`EmailAddress`, `MessageId`) and the `MessageIdGenerator` service.
- Cleaned up the project structure by removing the `Events` folder reference.

These changes simplify the domain model, reduce unused code, and align the project with updated architectural goals.
2026-07-27 15:37:34 +02:00
2d7af80cd3 Refactor RabbitMQ integration for lazy initialization
Refactored `OutgoingEmailConsumer` and `OutgoingEmailPublisher` to use `Lazy<Task<IChannel>>` for channel initialization, ensuring channels are created only when needed. Simplified initialization and disposal logic by centralizing channel management.

Replaced `CancellationTokenSource` in both classes with the `CancellationToken` provided by `RabbitMqConnectionFactory`, centralizing token management. Updated methods to use the new lazy initialization pattern.

Removed `RabbitMqConnectionFactory.InitAsync` and introduced `CreateChannelAsync` and `CreateConsumerAsync` methods for simplified channel and consumer creation. Managed cancellation tokens internally with a `CancellationTokenSource`.

Simplified `AsyncInitWorker` by removing dependencies on `RabbitMqConnectionFactory` and `OutgoingEmailPublisher`. Removed redundant initialization logic.

Cleaned up unused imports, improved logging consistency, and enhanced code readability and maintainability.
2026-07-27 15:24:26 +02:00
a2373f242a Refactor RabbitMQ connection handling logic
Updated `OutgoingEmailConsumer` and `OutgoingEmailPublisher` to use `GetDefaultConnectionAsync` instead of `GetConnectionAsync` for initializing RabbitMQ connections.

Renamed `GetConnectionAsync` to `GetDefaultConnectionAsync` in `RabbitMqConnectionFactory` to improve clarity and align with naming conventions. Updated `InitAsync` in `RabbitMqConnectionFactory` to use the renamed method.

These changes improve consistency, maintainability, and clarity in RabbitMQ connection management.
2026-07-27 13:05:17 +02:00
3611d527d4 Refactor RabbitMQ functionality to new project
Moved RabbitMQ-related functionality from the
`DigitalData.MessagingService.Infrastructure` project to a new
dedicated project/namespace `DigitalData.MessagingService.RabbitMQ`.

- Updated `DependencyInjection.cs` to use the new namespace.
- Added a project reference to `RabbitMQ.csproj` in the
  `Infrastructure.csproj` file.
- Removed `RabbitMqConfiguration.cs` and `RabbitMqConnectionFactory.cs`
  from the `Infrastructure` project.
- Updated namespaces in `OutgoingEmailConsumer.cs`,
  `OutgoingEmailPublisher.cs`, and `AsyncInitWorker.cs` to use
  `DigitalData.MessagingService.RabbitMQ`.

This refactor improves modularity, maintainability, and separation
of concerns by isolating RabbitMQ functionality in its own project.
2026-07-27 13:03:39 +02:00
885365df76 Add RabbitMQ support with configuration and connection
Added support for RabbitMQ integration:
- Updated project to target `net462` and `net8.0`.
- Added NuGet dependencies: `RabbitMQ.Client`, `Microsoft.Extensions.Logging.Abstractions`, and `Microsoft.Extensions.Options.ConfigurationExtensions`.
- Introduced `RabbitMqConfiguration` class for managing RabbitMQ settings.
- Implemented `RabbitMqConnectionFactory` for creating and managing RabbitMQ connections with lazy initialization, async disposal, and logging support.
2026-07-27 12:58:49 +02:00
94d1b73c4a Add NuGet metadata and package icon to project
Updated `DigitalData.MessagingService.Client.csproj`:
- Added NuGet metadata (PackageId, Authors, Company, etc.).
- Included `icon.png` as the package icon.
- Configured multi-targeting for `net462` and `net8.0`.
- Added XML documentation file generation.

Added `icon.png` binary file to the project.
2026-07-27 10:38:34 +02:00
84c72af993 Refactor solution structure and add RabbitMQ project
Simplified `DigitalData.MessagingService.Client.csproj` by removing metadata properties and adding a `RabbitMQ.Client` package reference.

Added a new project `DigitalData.MessagingService.RabbitMQ` targeting `net462` and `net8.0` with a `RabbitMQ.Client` package reference.

Updated `DigitalData.MessagingService.sln` to reflect the new project structure, including new paths, GUIDs, and solution configuration mappings.
2026-07-27 10:32:52 +02:00
0eda732d49 Remove MailKit dependency from project
The `MailKit` package reference (version 4.17.0) was removed from the `DigitalData.MessagingService.Infrastructure.csproj` file. This change suggests that the functionality provided by `MailKit` is no longer required or has been replaced by an alternative solution.
2026-07-27 10:12:19 +02:00
42d35d9a01 Add new MessagingService.Client project to solution
A new project `DigitalData.MessagingService.Client` has been added, targeting `net462` and `net8.0`. The project includes metadata for packaging and distribution, such as `PackageId`, `Authors`, `Version`, and more.

The solution file `DigitalData.MessagingService.sln` has been updated to include the new project, with build configurations for `Debug|Any CPU` and `Release|Any CPU`. The project is nested under the `infrastructure` folder in the solution structure.
2026-07-27 10:10:49 +02:00
23d52b9427 Add "presentation", "core", and "infrastructure" projects
Added three new projects ("presentation", "core", and
"infrastructure") to the solution file with unique GUIDs.
Updated the `GlobalSection(NestedProjects)` to reflect the
new project structure, nesting the new projects under the
parent project with GUID `{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}`.
Removed outdated nested project mappings and replaced them
with mappings for the new projects. Updated the solution
file to ensure proper integration of the new projects.
2026-07-27 10:06:20 +02:00
370872e126 Remove MimeKit package reference
The `MimeKit` package reference (version `4.17.0`) has been removed from the `DigitalData.MessagingService.Application.csproj` file. This change indicates that the project no longer relies on the `MimeKit` library for its functionality.
2026-07-27 10:04:24 +02:00
b6470fce5a Refactor: Remove IOutgoingEmailConsumer interface
Simplified the codebase by removing the `IOutgoingEmailConsumer` interface and directly using the `OutgoingEmailConsumer` class.

- Removed `IOutgoingEmailConsumer` from the application.
- Updated `DependencyInjection` to register `OutgoingEmailConsumer` directly.
- Modified `OutgoingEmailConsumer` to no longer implement the removed interface.
- Updated `AsyncInitWorker` to depend directly on `OutgoingEmailConsumer`.
- Simplified initialization logic for email consumer and publisher.

These changes eliminate an unnecessary abstraction layer, making the code easier to maintain while preserving functionality.
2026-07-27 10:04:05 +02:00
1617d4ab43 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.
2026-07-24 19:01:42 +02:00
5e587da957 refactor: Rename EmailPorifler to MessagingService 2026-07-24 13:59:43 +02:00
77d3b52d16 Refactor OutgoingEmailQueue for RabbitMQ best practices
Refactored the `OutgoingEmailQueue` class to use separate RabbitMQ
channels for publishing and consuming, improving thread safety and
aligning with RabbitMQ best practices. Replaced the synchronous
`Dispose` method with an asynchronous `DisposeAsync` for proper
cleanup of resources.

Introduced a `CancellationTokenSource` to manage the consumer's
lifetime independently, ensuring graceful shutdown. Updated the
`InitAsync` method to initialize dedicated channels and adjusted
RabbitMQ topology declarations to use the publish channel.

Replaced `_logger` with the injected `Logger` instance for
consistency and updated RabbitMQ operations to use the appropriate
channels with cancellation token support. Improved error handling
and logging in the consumer, and ensured acknowledgments operate
on the consume channel.

Simplified the class structure by removing redundant fields and
adopting C# 12 primary constructor syntax. Adjusted method
parameters for clarity and added comments to explain design
decisions. These changes enhance maintainability, scalability,
and reliability.
2026-07-24 13:42:53 +02:00
3cba69ec42 Refactor email queue worker and interface cleanup
Removed `InitAsync` from `IOutgoingEmailQueue` to decouple RabbitMQ initialization from the interface. Replaced `AsyncIniteWorker` with the correctly named `AsyncInitWorker` in `DependencyInjection.cs` and introduced a new, improved implementation of `AsyncInitWorker`.

The new `AsyncInitWorker` class initializes the outgoing email queue consumer using an event-driven RabbitMQ approach, with enhanced logging and error handling. Removed the outdated `AsyncIniteWorker` class to streamline the codebase.

These changes improve code clarity, maintainability, and correctness.
2026-07-24 12:30:36 +02:00
d91ed70001 Refactor: Replace EmailSenderWorker with AsyncIniteWorker
Removed EmailSenderWorker and its configuration, including
EmailSenderWorkerConfiguration. Introduced AsyncIniteWorker
as a replacement, simplifying the design by removing
configuration-based toggling.

- Deleted EmailSenderWorkerConfiguration.cs.
- Removed EmailSenderWorker and its registration from Program.cs.
- Registered AsyncIniteWorker in DependencyInjection.cs.
- Renamed and refactored EmailSenderWorker to AsyncIniteWorker.
- Updated namespace and removed unused configuration dependencies.
2026-07-24 11:54:34 +02:00
4a6af885de Refactor email queue interface and RabbitMQ handling
Removed `DequeueAsync` from `IOutgoingEmailQueue` and added `GetQueueDepthAsync` to query the queue's message count. Updated RabbitMQ connection and channel creation methods to support `CancellationToken`. Removed `DequeueAsync` implementation from `OutgoingEmailQueue`, signaling a shift away from direct message consumption. These changes improve cancellation handling and simplify the queue's responsibilities.
2026-07-23 17:00:59 +02:00
55e5d689ad 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.
2026-07-23 16:55:52 +02:00