feat: consume transactional email notifications
Add contract validation, SMTP delivery results, terminal failure context, neutral development seeding, and local Docker setup. Ref: IT-1033
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
namespace HrynCo.NotificationService.Worker;
|
||||
|
||||
using HrynCo.NotificationService.Contracts.Messages;
|
||||
using HrynCo.NotificationService.Worker.Services.EmailProcessing;
|
||||
using Hrynco.RabbitMq;
|
||||
|
||||
internal static class SendEmailDeliveryValidator
|
||||
{
|
||||
public static string? GetValidationError(
|
||||
SendEmailMessage message,
|
||||
RabbitMqMessageContext context,
|
||||
string supportedMessageType)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(context.MessageId))
|
||||
return "AMQP MessageId is required.";
|
||||
|
||||
if (!string.Equals(context.MessageType, supportedMessageType, StringComparison.Ordinal))
|
||||
return $"Unsupported AMQP message type '{context.MessageType ?? "<missing>"}'.";
|
||||
|
||||
try
|
||||
{
|
||||
SendEmailMessageValidator.Validate(message);
|
||||
return null;
|
||||
}
|
||||
catch (InvalidDataException exception)
|
||||
{
|
||||
return exception.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user