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: eventbridge-pipes-dynamic-message-group-id/README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# Assigning a dynamic message group ID from the message body using EventBridge Pipes
1
+
# Assigning a dynamic message group ID from the message body using Amazon EventBridge Pipes
2
2
3
-
EventBridge, a serverless event bus service, and SQS, a managed message queuing service, work together in event-driven architectures to route and process messages between AWS services and applications. While EventBridge routes messages to SQS queues for processing by microservices, FIFO queues can be used for strict message ordering. Although EventBridge cannot directly set message group IDs for organizing related messages, EventBridge Pipes provides a solution by allowing dynamic message group ID assignment based on event properties, enabling ordered processing for specific users, applications, or locations without additional coding.
3
+
Amazon EventBridge, a serverless event bus service, and Amazon SQS, a managed message queuing service, work together in event-driven architectures to route and process messages between AWS services and applications. While Amazon EventBridge routes messages to Amazon SQS queues for processing by microservices, FIFO queues can be used for strict message ordering. Although Amazon EventBridge cannot directly set message group IDs for organizing related messages, Amazon EventBridge Pipes provides a solution by allowing dynamic message group ID assignment based on event properties, enabling ordered processing for specific users, applications, or locations without additional coding.
4
4
5
-
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/eventbridge-pipes-dynamic-message-group-id
5
+
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/Amazon EventBridge-pipes-dynamic-message-group-id
6
6
7
7
> [!Important]
8
8
> This application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.
@@ -22,55 +22,55 @@ Learn more about this pattern at Serverless Land Patterns: https://serverlesslan
22
22
```
23
23
2. Change directory to the pattern directory:
24
24
```
25
-
cd eventbridge-pipes-dynamic-message-group-id
25
+
cd Amazon EventBridge-pipes-dynamic-message-group-id
26
26
```
27
27
28
28
3. Build and deploy the SAM application
29
29
```bash
30
-
sam build && sam deploy --guided
30
+
sam deploy --guided
31
31
```
32
32
33
33
During the prompts:
34
34
* Enter a stack name
35
35
* Enter the desired AWS Region
36
36
* Allow SAM CLI to create IAM roles with the required permissions.
37
37
38
-
You can accept all other defaults. Copy down the SQS Output Queue URL. You'll use this later in testing.
38
+
You can accept all other defaults. Copy down the Amazon SQS Output Queue URL. You'll use this later in testing.
39
39
40
40
Once you have run `sam deploy --guided` mode once and saved arguments to a configuration file (samconfig.toml), you can use `sam deploy` in future to use these defaults.
41
41
42
42
## How it works
43
-

43
+

44
44
45
-
This project implements an event processing pipeline using AWS EventBridge and SQS FIFO queues. The pipeline consists of:
45
+
This project implements an event processing pipeline using Amazon EventBridge and Amazon SQS FIFO queues. The pipeline consists of:
46
46
47
-
- An EventBridge rule that captures events from "my-custom-app" source
48
-
- An input SQS FIFO queue that receives events from the EventBridge rule
49
-
- An EventBridge pipe that processes messages from the input queue and dynamically sets the message group ID for the target SQS FIFO queue
50
-
- An output SQS FIFO queue that receives processed messages
47
+
- An Amazon EventBridge rule that captures events from "my-custom-app" source
48
+
- An input Amazon SQS FIFO queue that receives events from the Amazon EventBridge rule
49
+
- An Amazon EventBridge pipe that processes messages from the input queue and dynamically sets the message group ID for the target Amazon SQS FIFO queue
50
+
- An output Amazon SQS FIFO queue that receives processed messages
51
51
52
52
A key component of this pattern is the syntax in the EventBrige Pipe Target to obtain the correct property value to set the message group id. The following shows an example in the AWS Console. You can also view this configuration in the SAM template under the CustomEventPipe resource.
To test, you'll send an event from a custom source to EventBridge, which will trigger the EventBridge rule to send the event to an SQS FIFO Queue. You'll then wait for the EventBridge pipe to process and finally verify the message within the destination SQS FIFO queue with the message group ID set.
57
+
To test, you'll send an event from a custom source to Amazon EventBridge, which will trigger the Amazon EventBridge rule to send the event to an Amazon SQS FIFO Queue. You'll then wait for the Amazon EventBridge pipe to process and finally verify the message within the destination Amazon SQS FIFO queue with the message group ID set.
58
58
59
-
1. Send a test event to EventBridge. Take a look at the event structure and attributes. The account attribute will be used as the message group ID.
59
+
1. Send a test event to Amazon EventBridge. Take a look at the event structure and attributes. The account attribute will be used as the message group ID.
2. Wait for a couple seconds for the EventBridge pipe to process the message, then check the output queue. Make sure you replace the queue-url value with the correct output queue URL from deployment.
64
+
2. Wait for a couple seconds for the Amazon EventBridge pipe to process the message, then check the output queue. Make sure you replace the queue-url value with the correct output queue URL from deployment.
65
65
```bash
66
-
aws sqs receive-message \
66
+
aws Amazon SQS receive-message \
67
67
--queue-url <OUTPUT_QUEUE_URL> \
68
68
--attribute-names All \
69
69
--message-attribute-names All \
70
70
--max-number-of-messages 10
71
71
```
72
72
73
-
You should see a list of messages. View the event and take note of the MessageGroupID under the Attributes section. This originally came from your event input "accountId" property. The EventBridge Pipe is what allows us to perform this modification. Feel free to modify the event, send additional events to EventBridge and review the output queue messages.
73
+
You should see a list of messages. View the event and take note of the MessageGroupID under the Attributes section. This originally came from your event input "accountId" property. The Amazon EventBridge Pipe is what allows us to perform this modification. Feel free to modify the event, send additional events to Amazon EventBridge and review the output queue messages.
Copy file name to clipboardExpand all lines: eventbridge-pipes-dynamic-message-group-id/example-pattern.json
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
{
2
-
"title": "EventBridge Pipes Dynamic Message Group Id",
3
-
"description": "Uses EventBridge Pipes to dynamically retrieve and set the message group ID for a SQS FIFO destination queue",
4
-
"language": "",
2
+
"title": "Set an Amazon SQS FIFO queue's message group ID with an EventBridge Pipe",
3
+
"description": "Uses Amazon EventBridge Pipes to dynamically retrieve and set the message group ID for a SQS FIFO destination queue",
4
+
"language": "YAML",
5
5
"level": "200",
6
6
"framework": "AWS SAM",
7
7
"introBox": {
8
8
"headline": "How it works",
9
9
"text": [
10
-
"This pattern demonstrates how to use EventBridge rules, EventBridge Pipes and SQS FIFO queues to dynamically retrieve and set a message group ID from the message body for an SQS FIFO queue."
10
+
"This pattern demonstrates how to use an Amazon EventBridge rule, Amazon EventBridge Pipes and Amazon SQS FIFO queues to dynamically retrieve and set a message group ID from the message body for an Amazon SQS FIFO queue."
0 commit comments