Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New serverless pattern - Serverless Messaging Redrive #2543

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

zalilias
Copy link

Description of changes:
A serverless AWS solution for processing and fixing malformed messages using SQS queues and Lambda functions. This system automatically handles message validation, applies fixes where possible, and routes messages to appropriate queues based on their fixability. With built-in error handling and detailed logging, it provides a robust framework for message processing that can be easily extended for specific business needs.

The architecture uses AWS Lambda for processing, multiple SQS queues for message routing, and includes a dead-letter queue (DLQ) for messages requiring human intervention. Built with AWS SAM.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

@benjymoses benjymoses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to include a README.md with a detailed description of what this sample is, as well as deployment, testing, and deletion instructions.

You also need to include the *pattern.json file as per the sample adapted to your needs.

If any of the feedback / comments aren't clear, feel free to DM me offline to discuss and I can help point you in the right direction.

import logging

# Set up logging
logger = logging.getLogger()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an opportunity to use the PowerTools logging module here instead of Python native?

@@ -0,0 +1,121 @@
import json
import logging

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use PowerTools logging implementation?

@benjymoses
Copy link

@ellisms I've been helping @zalilias with this and have done a first cursory review. It's worth letting him parse through that and integrate / reject my feedback before you do your review so you're making good use of your time.

Copy link

@benjymoses benjymoses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zalilias thanks for bearing with me doing this next pass for you. This has come a long way but before we send to @ellisms for review I think there's a few more bits to go through.

As usual, if any of my comments don't make sense or you're not sure, just ping me 👍

@zalilias
Copy link
Author

Many thanks for all of your recommendations @benjymoses, apologies for the delay in getting this done from my end. I've implemented the changes into my existing code and hopefully should be good to be published soon 🚀

Copy link

@benjymoses benjymoses left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zalilias lots of good changes in here that help with clarity. I don't recall if we talked about putting the architecture diagram in to the readme, but you can do that in parallel to the formal review. Do you want to kick those 2 bits off now?

@benjymoses
Copy link

@ellisms can you do your formal review against the standards for Serverlessland Patterns now please before merging?

@zalilias
Copy link
Author

Thanks for your support on this @benjymoses ! I'll look to submit my architecture this week

@ellisms
Copy link
Contributor

ellisms commented Feb 26, 2025

@benjymoses Sure, I'll add it to my list.
@zalilias Can you resolve the conversations you've taken care of? It'll make it easier for me to review. Thanks!

@zalilias
Copy link
Author

Thanks @ellisms, I've resolved the majority now, other than powertools which I can add in.

@ellisms
Copy link
Contributor

ellisms commented Mar 6, 2025

Hi @zalilias , I'm working on the review and testing. I came across the following error in the decision function, that I don't think is expected:

[ERROR] UnboundLocalError: cannot access local variable 'original_message_id' where it is not associated with a value
Traceback (most recent call last):
  File "/var/task/app.py", line 160, in lambda_handler
    logger.error(f"Error processing message {original_message_id}: {str(e)}")

@zalilias
Copy link
Author

zalilias commented Mar 11, 2025

Hi Mike, many thanks for your comments and thoughts, I have implemented the changes outlined. Is there anything else pending from my end?

```
2. Change directory to the pattern directory:
```
cd serverless-patterns/serverless-messaging-redrive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cd serverless-patterns/serverless-messaging-redrive
cd serverless-patterns/serverless-message-redrive

"authors": [
{
"name": "Ilias Ali",
"image": "link-to-your-photo.jpg",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a publicly-accessible image.

@ellisms
Copy link
Contributor

ellisms commented Mar 20, 2025

Hi @zalilias - I re-tested and everything tested OK. Just requesting 2 minor edits. Thanks!

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.

4 participants