Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a SNS Filter Policy that matches nested message attributes?

Tags:

amazon-sns

I've created an SNS topic, and I'd like to subscribe to it with a filter policy that matches a nested attribute. For example, given a message like this:

{
  "foo": {
    "bar": "baz"
  },
  "quux": "vorp"
}

I'd like to match only messages where the bar attribute of foo is equal to baz.

The documentation I've found so far only mentions matching attributes specified at the top level. I'm interested in a nested attribute. For the purposes of this question, let's assume I don't control the structure of the message.

like image 550
Lucas Wilson-Richter Avatar asked Oct 17 '18 00:10

Lucas Wilson-Richter


1 Answers

Subscription filters don't act on the message (body, payload). They only act on the message attributes.

Message attributes are not complex objects... their only types are string, string array, number, and binary. If a message attribute contains a serialized object (e.g. JSON), subscription filters aren't designed to support extracting/matching the serialized data inside.

like image 166
Michael - sqlbot Avatar answered Sep 28 '22 01:09

Michael - sqlbot