On the SNS Message filtering page there is an example for AND/OR Logic as follows
AND logic : Apply AND logic by using multiple attribute names (keys). For example, the policy:
{
"customer_interests": ["rugby"],
"price_usd": [{"numeric":[">", 100]}]
}
OR logic : Apply OR logic by assigning multiple values to an attribute name. For example, the policy attribute:
"customer_interests": ["rugby", "football", "baseball"]
However how can we apply 'OR' logic for multiple attribute names (keys)
So for example what will be the policy if I want to change the first example
From
(customer_interests="rugby" AND price_usd > 100)
To
(customer_interests="rugby" OR price_usd > 100)
When you subscribe an Amazon SQS FIFO queue to an SNS FIFO topic, you can use message filtering to specify that the subscriber receives a subset of messages, rather than all of them. Each subscriber can set its own filter policy as a subscription attribute.
Q: Does Amazon SNS guarantee that messages are delivered to the subscribed endpoint? Yes, as long as the subscribed endpoint is accessible. A message delivery fails when Amazon SNS can't access a subscribed endpoint, due to either a client-side or a server-side error.
HTTP/HTTPS notification JSON format When Amazon SNS sends a notification to a subscribed HTTP or HTTPS endpoint, the POST message sent to the endpoint has a message body that contains a JSON document with the following name-value pairs. The Message value specified when the notification was published to the topic.
Message filtering enables you select the criteria at which you want messages to display in Mailbox Server. Message filtering limits the number of messages and attachments that the system displays. This makes it easier to locate the messages that you want to track.
You would have to create 2 separate subscriptions to same endpoint and attach different filters:
For 1st subscription:
{
"customer_interests": ["rugby"]
}
For 2nd subscription:
{
"price_usd": [{"numeric":[">", 100]}]
}
I didn't find any way of having OR in single filter, but with creating multiple subscriptions to same endpoint definitely works (used it mysqlf on my account)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With