amazon-web-services - How to save failed messages from Amazon SNS into Amazon S3
问题描述
I would like to know if it's possible to persist all unacknowledged messages from an SNS topic to an S3 file given a certain time window. These messages don't necessarily need to follow the original order in the S3 file, a timestamp attribute is enough.
解决方案
没有将消息从 Amazon SNS 保存到 Amazon S3 的内置功能。
然而,本周 AWS 为 Amazon SNS 引入了死信队列。
从Amazon SNS 添加对死信队列 (DLQ) 的支持:
您现在可以为 Amazon Simple Notification Service (SNS) 订阅设置死信队列 (DLQ),以捕获无法送达的消息。Amazon SNS DLQ 通过存储消息以防您的订阅终端节点无法访问,从而使您的应用程序更具弹性和持久性。
Amazon SNS DLQ 是标准的 Amazon SQS 队列。
因此,如果 Amazon SNS 无法传递消息,它可以自动将其发送到 Amazon SQS 队列。您可以稍后查看/处理这些失败的消息。例如,您可以创建一个AWS Lambda 函数,当消息到达死信队列时触发该函数。然后该函数可以将消息存储在 Amazon S3 中。
推荐阅读
- python - 小数缓存是在 Python 规范中定义的,还是一个实现细节?
- javascript - 在 nextjs 应用程序中,如何从另一个组件触发一个组件中的功能
- sed - 使用 sed 删除特殊字符 (^@)
- javascript - 参数匹配返回空 React-router
- react-native - React Native 底部选项卡导航器。tabBarButton: () => {} 选项不起作用
- html - 反应等待功能完成?
- python - 将数据帧保存到 .csv 并在不指定文件路径的情况下创建文件夹
- python - 静态文件未在 Django 中加载
- java - 将大的临时文件放入番石榴缓存中是个好主意吗?
- json - Swift JSONEncoding 问题与编码字典列表