Can I Use SQS Fair Queues with EventBridge?

0
1
Asked By CoolCoder99 On

Hey everyone! I just saw AWS announced fair queues for SQS to tackle noisy-neighbor issues, which sounds awesome for an upcoming project. However, I'm curious if this feature works with EventBridge. I attempted to set up a sample application using Terraform, and when I tried to configure my queue with the message_group_id drawn from an event field, I hit a validation error. It seems like this might only be applicable to FIFO queues at the moment. Is that the case, or could I be doing something wrong? Here's a snippet of my Terraform code for reference:

```lang-hcl
resource "aws_cloudwatch_event_target" "sqs_target" {
rule = aws_cloudwatch_event_rule.all_events.name
arn = aws_sqs_queue.events.arn

event_bus_name = aws_cloudwatch_event_bus.events.name

sqs_target {
message_group_id = "$.messageGroupId"
}
}
```

This is the error I'm facing:

> operation error EventBridge: PutTargets, https response error StatusCode: 400, RequestID: ..., api error ValidationException: Parameter(s) MessageGroupId not valid for target ...

Here's a link to AWS's blog post for more context: https://aws.amazon.com/blogs/compute/building-resilient-multi-tenant-systems-with-amazon-sqs-fair-queues/

2 Answers

Answered By CloudWhizKid On

You're correct that `message_group_id` is only for FIFO queues, not standard ones. Even with the new fair queues, you can't use this parameter with standard SQS queues. The fair queue improvements help balance message distribution, but they don't change the fact that standard queues don’t accept message groups. If you want ordered messages, switching to a FIFO queue is your best bet! Otherwise, just drop the `message_group_id` and benefit from the fairness improvements solo.

DevNinja007 -

That's partly true! While you _can_ use `message_group_id` to achieve fair queuing, the setup with EventBridge isn't ready just yet.

Answered By TechSavvyGiraffe On

It looks like you're hitting a wall because currently, EventBridge doesn't support adding metadata like `message_group_id` to messages in the queue. This is a limitation you'll have to work around for now. You might want to consider this when designing your flow.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.