Skip to content

Conversation

@nicopizzo
Copy link
Contributor

This PR extends the NotificationService to implement a more robust message handling mechanism that better emulates standard message acknowledgment patterns (ACK/NACK). A typical use case is for notifications that process with error should be retried until the maximum number of reads are reached. Once maximum number of reads are reached, Amazon SQS will automatically move the message to a dead letter queue if configured.

Key Changes:

  • New Interface: Added IMessageReceiverWithResult, which allows consumers to return a boolean result for each message.

    • ACK (True): The message was processed successfully and will be deleted from the queue.
    • NACK (False): The message processing failed or was declined. It remains in the queue, allowing it to become visible again for retry or eventually be moved to a Dead Letter Queue (DLQ) after the maximum receive count is exceeded.
  • Implementation: Implemented the Adapter Pattern and Method Overloading in NotificationService to safely handle different receiver types without runtime type checking.

  • Backward Compatibility: Existing functionality remains exactly the same. Consumers using the original IMessageReceiver will experience no changes in behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant