对于使用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"}
我在做什么错?以及如何确保消息确实获得了此信息?