使用SQS进行类似运动的分片?

问题描述 投票:0回答:1

我有兴趣用SQS替换Kinesis(因为它很昂贵,并且我不需要历史记录),但是我需要一种分片/分区机制,特别是在使用Lambda处理时。

我看到SQS FIFO队列最近已获取Lambda事件映射-

https://aws.amazon.com/blogs/compute/new-for-aws-lambda-sqs-fifo-as-an-event-source/

我认为通过使用MessageGroupID使分区非常接近。

消息处理被描述为通过以下规则进行-

1) Return the oldest message where no other message with the same MessageGroupId is in flight.
2) Return as many messages with the same MessageGroupId as possible.
3) If a message batch is still not full, go back to the first rule. As a result, it’s possible for a single batch to contain messages from multiple MessageGroupIds.

1)和2)听起来很棒-每个Lambda请求批处理仅包含一个MessageGroupID-但随后3)似乎把它们搞砸了:-(

关于确保每个Lambda请求批次仅包含来自单个MessageGroupID的策略的任何想法?可能通过MessageDeduplicationID吗?

amazon-web-services amazon-sqs amazon-kinesis
1个回答
0
投票

怀疑这里的答案是每个“分区”仅使用一个队列,因为SQS定价基于每个消息而不是每个队列。如果您有很多“分区”,那么请以编程方式在堆栈启动过程中创建它们(例如,作为CodeBuild脚本的一部分),而不是在Cloudformation中定义每个队列。

© www.soinside.com 2019 - 2024. All rights reserved.