【发布时间】:2018-07-19 19:08:39
【问题描述】:
对于使用 AWS 服务进行本地开发,我使用的是 localstack。现在我想使用 SNS,当我发布消息时,订阅者没有收到“元数据”(如 MessageId、TopicArn、时间戳)
我已经采取了接下来的步骤:
-
启动 docker 容器:
docker run --net=host -it -p 4567-4578:4567-4578 -p 8080:8080 atlassianlabs/localstack -
创建了一个 SNS 主题:
aws --endpoint-url=http://localhost:4575 sns create-topic --name test-topic -
订阅主题:
aws --endpoint-url=http://localhost:4575 sns subscribe --topic-arn arn:aws:sns:eu-west-1:123456789012:test-topic --protocol http --notification-endpoint http://localhost.dev.local/path -
最后,我发布了一条消息:
aws --endpoint-url=http://localhost:4575 sns publish --topic-arn arn:aws:sns:eu-west-1:123456789012:test-topic --message "the message"
订阅者成功收到消息,但缺少“messageId”、“Timestamp”和“TopicArn”:
实际结果:
{"Message": "the message", "Type": "Notification"}
预期结果:
{"TopicArn": "arn:aws:sns:eu-central-1:123456789012:test-topic", "MessageId": "af3a73ef-b0b2-4f78-acb1-1dee52d002d2", "Message": "the message", "Type": "Notification" "Timestamp" : "2018-07-19T16:04:28.857Z"}
我做错了什么?以及如何确保消息确实获得了这些信息?
【问题讨论】:
-
你解决过这个问题吗?
-
嗨 Adam,不,我还没有解决它,但 Ignas 注意到它在提出 GitHub 问题后已得到修复。
标签: amazon-web-services amazon-sns localstack