gpt4 book ai didi

amazon-web-services - SNS 是否允许基于 String.array 中多个值的存在进行过滤

转载 作者:行者123 更新时间:2023-12-05 05:07:13 25 4
gpt4 key购买 nike

我想使用 SNS 发布通知,我希望订阅者能够过滤多个消息属性。其中一个消息属性将是一个 String.Array。例如,通知可以有两个属性 fruit_found 和 all_fruits_found。

"fruit_found": ["Apple"],"all_fruits_found":["Mango","Apple","Banana"]

在某些用例中,订阅者可能需要知道是否同时找到了 Mango 和 Apple,然后才使用通知,否则将其丢弃。是否可以在 SNS 中这样做?

最佳答案

所以我不得不与 SNS 客户支持团队交谈,发现他们在 String.array 消息属性中没有 AND 操作。

我发现的一个解决方法是为您要提供的过滤器数量复制相同的消息属性。对于问题中的消息,它应该具有如下结构:

"fruit_found": ["Apple"],
"all_fruits_found_filter_1":["Mango","Apple","Banana"],
"all_fruits_found_filter_2":["Mango","Apple","Banana"]

为找到 Mango 和 Apple 时定义的过滤策略是:

"all_fruits_found_filter_1": ["Mango"] //and
"all_fruits_found_filter_2": ["Apple"]

但是,每条 SNS 消息最多只能有 10 个消息属性。因此,如果您在该边界内,则上述解决方案可以正常工作。否则你就得引用阿里的回答了。

关于amazon-web-services - SNS 是否允许基于 String.array 中多个值的存在进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59313971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com