sns
sns copied to clipboard
Message attributes seem to be ignored.
It seems message attributes are not propagated when message is sent to http or SQS subscription.
I have noticed this when using elasticmq. Sending a message with attributes directly to the queue does work, but not via sns.
Actually it is working. Raw message delivery must be enabled. You have to add the following to your subscription json:
"subscriptionAttributes": {
"RawMessageDelivery": "true"
}
Is it possible to enable a filter policy on a subscription?
Use case: publish to a topic a message with attribute "cluster:c1" to be received by subscription with a filter policy "cluster:c1".
I've tried implementing filter policy into the subscriptions json but the message seems to be received by all queues subscribed to the topic.
Command used to publish message:
aws sns --endpoint-url http://localhost:4575 publish --topic-arn "<topic-arn>" --message "Hello c1" --message-attributes '{ "cluster":{ "DataType":"String","StringValue":"c1" }}'
Example subscription json:
"subscriptions": [ { "arn": "<arn>", "owner": "", "protocol": "sqs", "endpoint": "<endpoint>", "topicArn": "<topic-arn>", "RawMessageDelivery": "true", "filterPolicy": { "cluster": ["c1"] } },
Actually it is working. Raw message delivery must be enabled. You have to add the following to your subscription json:
"subscriptionAttributes": { "RawMessageDelivery": "true" }
But if "Raw message delivery" is disabled, the attributes should still appear in the message body.
Hello and apologies for the self-advertisement, I've created local-sns as a reimplementation of this project, which includes Message Attribute support. See https://github.com/jameskbride/local-sns/issues/21 for more details.