AWS SNS 主题数量限制
AWS SNS number of topics limit
会有用户数。每个用户可能有多个区域。我想为每个区域发送 3 个类别的电子邮件警报。每个类别将有多个电子邮件端点。
所以为每个类别创建一个主题可行吗?
例如 - 如果我的每个区域有 3 个类别,我将必须为每个类别创建一个主题。所以每个区域都会有三个主题,每个主题都会有一些订阅者。
我想问一下,这个方法正确还是有更好的选择?
关于你提到的场景,我猜Filter policy for SNS suits best. You can also follow this AWS tutorial 'Filter Messages Published to Topics'是为了这个。
过滤策略的思路很简单,
向主题发布消息时,您还在消息中包含一些属性(元数据),例如 area=2, category=3
现在,此消息将仅发送给在其订阅政策(属性)中提及此 key-value 对的订阅者或所有根本没有任何政策的订阅者。
您定义订阅策略(属性),同时从客户端在您的代码中发出订阅请求。
要发布的示例消息(注意消息中的 MessageAttributes):
{
"Type" : "Notification",
"MessageId" : "e3c4e17a-819b-5d95-a0e8-b306c25afda0",
"TopicArn" : "arn:aws:sns:us-east-1:111122223333:MySnsTopic",
"Message" : message body with transaction details . . .
"Timestamp" : "2017-11-07T23:28:01.631Z",
"SignatureVersion" : "1",
"Signature" : signature . . .
"UnsubscribeURL" : unsubscribe URL . . .
"MessageAttributes" : {
"customer_interests" : {"Type":"String.Array","Value":"[\"soccer\", \"rugby\", \"hockey\"]"},
"store" : {"Type":"String","Value":"example_corp"},
"event" : {"Type":"String","Value":"order_placed"},
"price_usd" : {"Type":"Number","Value":210.75}
}
}
订阅者政策示例:
{
"store": ["example_corp"],
"event": [{"anything-but":"order_cancelled"}],
"customer_interests": ["rugby", "football", "baseball"],
"price_usd": [{"numeric":[">=", 100]}]
}
关于限制:
默认情况下,SNS 为每个主题提供 1000 万个订阅,每个帐户提供 100,000 个主题。要请求更高的限制,请联系支持人员。 Link
我希望这个答案能让您朝着正确的方向前进 think/move
会有用户数。每个用户可能有多个区域。我想为每个区域发送 3 个类别的电子邮件警报。每个类别将有多个电子邮件端点。
所以为每个类别创建一个主题可行吗?
例如 - 如果我的每个区域有 3 个类别,我将必须为每个类别创建一个主题。所以每个区域都会有三个主题,每个主题都会有一些订阅者。
我想问一下,这个方法正确还是有更好的选择?
关于你提到的场景,我猜Filter policy for SNS suits best. You can also follow this AWS tutorial 'Filter Messages Published to Topics'是为了这个。
过滤策略的思路很简单,
向主题发布消息时,您还在消息中包含一些属性(元数据),例如 area=2, category=3
现在,此消息将仅发送给在其订阅政策(属性)中提及此 key-value 对的订阅者或所有根本没有任何政策的订阅者。
您定义订阅策略(属性),同时从客户端在您的代码中发出订阅请求。
要发布的示例消息(注意消息中的 MessageAttributes):
{
"Type" : "Notification",
"MessageId" : "e3c4e17a-819b-5d95-a0e8-b306c25afda0",
"TopicArn" : "arn:aws:sns:us-east-1:111122223333:MySnsTopic",
"Message" : message body with transaction details . . .
"Timestamp" : "2017-11-07T23:28:01.631Z",
"SignatureVersion" : "1",
"Signature" : signature . . .
"UnsubscribeURL" : unsubscribe URL . . .
"MessageAttributes" : {
"customer_interests" : {"Type":"String.Array","Value":"[\"soccer\", \"rugby\", \"hockey\"]"},
"store" : {"Type":"String","Value":"example_corp"},
"event" : {"Type":"String","Value":"order_placed"},
"price_usd" : {"Type":"Number","Value":210.75}
}
}
订阅者政策示例:
{
"store": ["example_corp"],
"event": [{"anything-but":"order_cancelled"}],
"customer_interests": ["rugby", "football", "baseball"],
"price_usd": [{"numeric":[">=", 100]}]
}
关于限制:
默认情况下,SNS 为每个主题提供 1000 万个订阅,每个帐户提供 100,000 个主题。要请求更高的限制,请联系支持人员。 Link
我希望这个答案能让您朝着正确的方向前进 think/move