AWS SNS按名称获取主题 [英] AWS SNS get topic by name

查看:75
本文介绍了AWS SNS按名称获取主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用AWS SNS将推送通知发送到我的应用程序.今天,要获取我要向其发送推送通知的主题,我需要加载所有主题-使用SNS客户端函数listTopics()-并检查每个主题以查看ARN是否具有我要查找的主题的名称为了.

I started to work with AWS SNS to send push notifications to my app. Today, to get a topic that I want to send push notifications to, I need to load all topics – using SNS client function listTopics() - and check each topic to see if the ARN has the name of the topic that I'm looking for.

我认为这是获取主题ARN的一种非常低效的方法,我想知道是否有一种最有效的方法来获取此信息,例如函数getTopicByName或其他.

I think that it's a very inefficient way to get a topic ARN, and I'd like to know if there is a most efficient way to get this information, like a function getTopicByName or something else.

如果不是,我想知道ARN是否是不变的,是否可以在数据库中存储主题ARN?

If not, I'd like to know if ARN is immutable, and if can I store the topic ARN on my database?

谢谢.

推荐答案

我不知道通过名称查找SNS主题的任何方法.

I don't know of any way to look up an SNS topic by name.

ARN是不可变的.在SNS主题的生命周期内不会改变.特别是,根据文档用于SNS主题的ARN的格式如下:

The ARN is immutable. It will not change for the life of the SNS topic. In particular, according to the documentation an ARN for an SNS topic is in the following format:

arn:aws:sns:region:account-id:topicname

因此,更改SNS主题的ARN的唯一方法是更改​​名称(在这种情况下,按名称查找也会中断),或者删除该主题并在新区域或完全不同的帐户中重新创建,在这种情况下,它就不再是同一主题了.

So the only way for the SNS topic's ARN to change would be to change the name (in which case your lookup by name would also break), or delete the topic and recreate it in a new region or in an entirely different account, in which case it would not really the same topic anymore.

这篇关于AWS SNS按名称获取主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆