I'm using 'aws-sdk' gem.
我正在使用'aws-sdk'宝石。
https://github.com/aws/aws-sdk-ruby
Using below gem
使用下面的宝石
'aws-sdk (1.11.0)'
I want to use filtering messages function.
我想使用过滤消息功能。
https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html
I understood I should set Filter policy.
我明白我应该设置过滤策略。
but, I could not find how to set it.
但是,我找不到如何设置它。
I have read below.
我在下面看过。
https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/sns-examples.html https://docs.aws.amazon.com/sdk-for-ruby/v3/api/index.html
How can I use this function?
我该如何使用此功能?
Thank you.
1 个解决方案
#1
0
I could set FilterPolicy using set_subscription_attributes.
DeliveryPolicy and RawMessageDelivery were valid attribute names in the description of this page, and FilterPolicy could be used too.
我可以使用set_subscription_attributes设置FilterPolicy。 DeliveryPolicy和RawMessageDelivery是此页面描述中的有效属性名称,也可以使用FilterPolicy。
params = {subscription_arn: subscription_arn, attribute_name: 'FilterPolicy', attribute_value: '{"event_type": ["order_placed", "order_cancelled"]}'}
client.set_subscription_attributes(params)
#1
0
I could set FilterPolicy using set_subscription_attributes.
DeliveryPolicy and RawMessageDelivery were valid attribute names in the description of this page, and FilterPolicy could be used too.
我可以使用set_subscription_attributes设置FilterPolicy。 DeliveryPolicy和RawMessageDelivery是此页面描述中的有效属性名称,也可以使用FilterPolicy。
params = {subscription_arn: subscription_arn, attribute_name: 'FilterPolicy', attribute_value: '{"event_type": ["order_placed", "order_cancelled"]}'}
client.set_subscription_attributes(params)