mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-10-28 10:48:49 -04:00
22 lines
736 B
C#
22 lines
736 B
C#
using Cleanuparr.Infrastructure.Features.Messaging;
|
|
using Cleanuparr.Infrastructure.Features.Notifications.Models;
|
|
|
|
namespace Cleanuparr.Infrastructure.Features.Notifications.Consumers;
|
|
|
|
/// <summary>
|
|
/// Sends one queued notification to its configured providers.
|
|
/// </summary>
|
|
public sealed class NotificationConsumer : IMessageHandler<NotificationMessage>
|
|
{
|
|
private readonly NotificationService _notificationService;
|
|
|
|
public NotificationConsumer(NotificationService notificationService)
|
|
{
|
|
_notificationService = notificationService;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public Task HandleAsync(NotificationMessage message) =>
|
|
_notificationService.SendNotificationAsync(message.EventType, message.Context);
|
|
}
|