Retructured solution

This commit is contained in:
Khwezi Mngoma
2026-05-13 20:06:24 +02:00
parent 26075cd9a7
commit a42c51d7b2
231 changed files with 1618 additions and 1408 deletions
@@ -0,0 +1,33 @@
using LiteCharms.Features.Abstractions;
using LiteCharms.Features.ServiceBus.Queues;
namespace LiteCharms.Features.ServiceBus.Exchanges;
public class EmailExchange(EmailQueue messages, ILogger<EmailExchange> logger, IPublisher mediator) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await foreach(IEvent? message in messages.Incoming.ReadAllAsync(stoppingToken))
{
try
{
switch (message.Name)
{
case "SendShopEmailEnquiryEvent":
await mediator.Publish(message, stoppingToken);
break;
case "ProcessEmailNotificationsEvent":
await mediator.Publish(message, stoppingToken);
break;
default:
logger.LogWarning("Unsupported email event {Event}", message.Name);
break;
}
}
catch (Exception ex)
{
logger.LogError(ex, ex.Message);
}
}
}
}