Skip to content

Commit

Permalink
logic for setting transient error feedback to new status in db #GCPAc…
Browse files Browse the repository at this point in the history
…tive
  • Loading branch information
acn-sbuad committed Dec 4, 2023
1 parent 916bc9c commit 726cff8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ In pgAdmin
To run a Kafka broker and Kafdrop (visualization and administration tool) locally you need to have Docker installed on your machine.

In a terminal navigate to the root of this repository
and run command `docker-compose -f setup-kafka.yml up -d`
and run command `docker compose -f setup-kafka.yml up -d`

Kafdrop will be available on localhost:9000
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,18 @@ public enum EmailNotificationResultType
/// <summary>
/// Invalid format for email address
/// </summary>
Failed_InvalidEmailFormat
Failed_InvalidEmailFormat,

/// <summary>
/// Recipient supressed by email service
/// </summary>
Failed_SupressedRecipient,

/// <summary>
/// Transient error, retry later
/// </summary>
/// <remarks>
/// Should not be used externally or persisted in db.
/// Only used for processing and logic in service layer.</remarks>
Failed_TransientError
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public async Task SendNotifications()
/// <inheritdoc/>
public async Task UpdateSendStatus(SendOperationResult sendOperationResult)
{
// set to new to allow new iteration of regular proceessing if transient error
if (sendOperationResult.SendResult == EmailNotificationResultType.Failed_TransientError)
{
sendOperationResult.SendResult = EmailNotificationResultType.New;
}

await _repository.UpdateSendStatus(sendOperationResult.NotificationId, (EmailNotificationResultType)sendOperationResult.SendResult!, sendOperationResult.OperationId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public class NotificationSummaryService : INotificationSummaryService
{ EmailNotificationResultType.Delivered, "The email was delivered to the recipient. No errors reported, making it likely it was received by the recipient." },
{ EmailNotificationResultType.Failed, "The email was not sent due to an unspecified failure." },
{ EmailNotificationResultType.Failed_RecipientNotIdentified, "The email was not sent because the recipient's email address was not found." },
{ EmailNotificationResultType.Failed_InvalidEmailFormat, "The email was not sent because the recipient’s email address is in an invalid format." }
{ EmailNotificationResultType.Failed_InvalidEmailFormat, "The email was not sent because the recipient’s email address is in an invalid format." },
{ EmailNotificationResultType.Failed_SupressedRecipient, "The email was not sent because the recipient’s email address is suppressed by the third party email service." },
{ EmailNotificationResultType.Failed_TransientError, "The email was not sent due to a transient error. We will retry sending the email." }
};

private readonly static List<EmailNotificationResultType> _successResults = new()
Expand Down

0 comments on commit 726cff8

Please sign in to comment.