How to do SNS filtering with prefix matching on String.Array type message attribute

156 Views Asked by At

Is there a way to apply SNS filtering to match all messages that has message attribute 'MyMessageAttribute ' ( type = String.Array ) and any of its value start with "MyPrefix" ?

I have searched on google and https://docs.aws.amazon.com/sns/latestbut couldn't find any example

1

There are 1 best solutions below

0
Quassnoi On
{
  "MyMessageAttribute": [
    {
      "prefix": "MyPrefix"
    }
  ]
}

In array attributes, the filters match if any of the array values matches the filter.

The closest thing to documenting this fact they have is the example for anything-but here:

Moreover, it matches the following message attribute (because it contains a value that isn't rugby or tennis):

"customer_interests": {"Type": "String.Array", "Value": "[\"rugby\", \"baseball\"]"}

, but I can assure you that it works.