You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: serverless-message-processing/README.md
+31-15Lines changed: 31 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,38 +11,47 @@ An adaptable pattern for message processing using AWS serverless services, featu
11
11
## Basic Flow
12
12
1. Messages enter through API Gateway
13
13
2. Main queue receives messages
14
-
3. Processor Lambda handles messages
15
-
4. Failed messages route to DLQs
16
-
5. Decision maker attempts an automated recovery
14
+
3. Lambda function polls the main queue using Event Source Mappings (ESMs) and handles the messages.
15
+
Read more about how Lambda synchronously processes queue messages in this [documentation.](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html)
16
+
4. Failed messages route to DLQs -In this case a failed message would be a malformed email, however this can be adapted to other use cases.
17
+
5. Decision maker attempts an automated recovery -In this sample, we remediate common email malform issues including whitespace and typos in domain extensions.
17
18
18
19
## Deployment
19
20
# Build the SAM application
21
+
The ```sam build ``` command prepares an application for subsequent steps in the developer workflow, such as local testing or deploying to AWS.
22
+
20
23
```
21
24
sam build
22
25
```
23
26
# Deploy the application
27
+
The ```sam deploy``` command deploys an application to the AWS Cloud using AWS CloudFormation. The ```--guided``` option is to have the AWS SAM CLI use prompts to guide you through the deployment.
28
+
24
29
```
25
30
sam deploy --guided
26
31
```
27
32
28
33
## Key Features
29
34
- Automatic retry mechanism
30
35
- Segregation of recoverable/fatal errors
31
-
-Extensible processing logic
36
+
-Processing logic with the potential for points of adaptation
32
37
33
38
## API Reference
34
39
# Send Message
35
-
```
36
40
37
-
POST /message
38
-
Content-Type: application/json
39
-
```
41
+
The following is an example API call that you can try with your own endpoint.
42
+
40
43
```
41
-
{
42
-
"messageType": "TYPE_A|TYPE_B|TYPE_C",
43
-
"payload": {},
44
-
"timestamp": "ISO8601_TIMESTAMP"
45
-
}
44
+
45
+
curl -X POST \
46
+
'https://\${endpoint}/prod/message' \
47
+
-H 'Content-Type: application/json' \
48
+
-d '{
49
+
"messageType": "TYPE_A",
50
+
"body": {
51
+
"email": "user@@example.com"
52
+
},
53
+
"timestamp": "2023-11-22T10:30:00Z"
54
+
}'
46
55
```
47
56
48
57
@@ -54,5 +63,12 @@ Content-Type: application/json
54
63
- Monitoring requirements
55
64
- API Design
56
65
57
-
## Note
58
-
This is a sample pattern. Adapt security, scaling, and processing logic according to your requirements.
Copy file name to clipboardExpand all lines: serverless-message-processing/example-pattern.json
+2-6Lines changed: 2 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,13 @@
1
1
{
2
-
"title": "Step Functions to Athena",
2
+
"title": "Serverless Messaging Redrive",
3
3
"description": "Create a Step Functions workflow to query Amazon Athena.",
4
4
"language": "Python",
5
5
"level": "200",
6
6
"framework": "SAM",
7
7
"introBox": {
8
8
"headline": "How it works",
9
9
"text": [
10
-
"This sample project demonstrates how to use a serverless solution for processing and fixing malformed messages using SQS queues and Lambda functions",
11
-
"The system automatically handles message validation, applies fixes where possible, and routes messages to appropriate queues based on their fixability.",
12
-
"It has built-in error handling and detailed logging, it provides a robust framework for message processing that can be easily extended for specific business needs.",
13
-
"This pattern uses AWS Lambda for processing, multiple SQS queues for message routing, and includes 2 dead-letter queue (DLQ) for messages requiring human intervention or for auto-remediation."
14
-
]
10
+
"This sample project demonstrates how to use a serverless solution for processing and fixing malformed messages using SQS queues and Lambda functions" ]
0 commit comments