Jacob Duval
Jacob Duval

Reputation: 539

SNS SQS fanout architecture

Looking at the documentation for this pattern it says

The Amazon SQS message contains the subject and message that were published to the topic along with metadata about the message in a JSON document

So when I publish to an SNS topic, the only properties that are forwarded are the subject of the notification, and the default parameter? Does this mean if I want to send json to my queues I have to stringify it and set it as the default parameter of the notification?

Upvotes: 0

Views: 1195

Answers (1)

Jacob Duval
Jacob Duval

Reputation: 539

If you check out the examples section of the SNS docs you can see there are options to specify messages to email, https, etc including sqs. If you want to send queue specific information on a notification then you can put it in there and it will overwrite the default parameter. An example in node

sns.publish({
  TopicArn: topicArn,
  MessageStructure: 'json',
  Message: JSON.stringify({
    default: JSON.stringify(defaultMessageJson),
    sqs: JSON.stringify(sqsMessageJson)
  })
})

Upvotes: 2

Related Questions