sns icon indicating copy to clipboard operation
sns copied to clipboard

Message attributes seem to be ignored.

Open mvmn opened this issue 8 years ago • 5 comments

It seems message attributes are not propagated when message is sent to http or SQS subscription.

mvmn avatar Mar 20 '17 17:03 mvmn

I have noticed this when using elasticmq. Sending a message with attributes directly to the queue does work, but not via sns.

mattwcole avatar Aug 07 '18 10:08 mattwcole

Actually it is working. Raw message delivery must be enabled. You have to add the following to your subscription json:

"subscriptionAttributes": {
  "RawMessageDelivery": "true"
}

mattwcole avatar Aug 10 '18 09:08 mattwcole

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"] } },

paul-cummings avatar Jun 24 '19 13:06 paul-cummings

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.

forsen avatar Dec 29 '22 14:12 forsen

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.

jameskbride avatar Dec 30 '23 22:12 jameskbride