0

Did anyone here manage to set the message group id for SQS to be dynamic? We are receiving updates from our Shopify stores through the AWS Eventbridge integrations. Whenever there is a peak in sales on a store we can only process a few events at a time because all of them are pushed to SQS with the same message group id.

Did anyone solve this issue?

Amazon Event Bridge

1
  • 1
    It sounds like you should be using a regular SQS queue instead of a FIFO queue. Commented Nov 21, 2024 at 17:39

1 Answer 1

0

The issue arises because SQS FIFO queues ensure strict message ordering by processing messages with the same MessageGroupId one at a time. If all events are assigned the same MessageGroupId, processing becomes bottlenecked.

To solve this problem while preserving order for specific use cases (e.g., per store), you can make the MessageGroupId dynamic.

For example one groupID per store or per type

{
    "MessageGroupId": "store1.shopify.com",
    "MessageBody": "{...event data...}"
}

you need to consider the throughput limits: FIFO queues support up to 300 messages per second per MessageGroupId. If even a single group hits this limit, consider splitting the group further. Also, adjusting the MessageGroupId scope changes the ordering guarantees. Make sure your application logic aligns with this change.

Or consider changing from SQS Fifo to normal SQS

Sign up to request clarification or add additional context in comments.

4 Comments

I have added a picture to my comment that shows that the event message group id. Is there a way to use a variable?
Based on the image you shared, it looks like you are defining the Message Group ID directly in AWS EventBridge. Unfortunately, EventBridge does not support directly referencing variables (like attributes from the event payload) for the Message Group ID in the default UI. You can configure the InputTransformer in EventBridge to dynamically set the MessageGroupId based on attributes in the event payload. For example, if the event payload includes a store identifier or a unique attribute like store_domain, you can extract that and use it for the MessageGroupId.
If the Input Transformer cannot handle your specific use case (e.g., complex transformations or combining multiple attributes), route the event to a Lambda function that dynamically assigns the MessageGroupId.
and the latest solution if you have a few predefined stores or event types, create multiple EventBridge rules targeting the same SQS FIFO queue with different hardcoded MessageGroupIds. This approach is less flexible but simpler to implement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.