Home:ALL Converter>Azure topic subscription filter / Subscription Rule

Azure topic subscription filter / Subscription Rule

Ask Time:2019-06-28T18:01:18         Author:Amit

Json Formatter

I have created a sample client which listens to a subscription that is attached to a Service-Bus topic. Now whenever a message is posted in that topic, its being captured by the client listening to subscriber. (as documented below)

https://github.com/Azure/azure-service-bus/tree/master/samples/DotNet/GettingStarted/Microsoft.Azure.ServiceBus/TopicSubscriptionWithRuleOperationsSample

Now I would like to add a filter/rule so that only the messages that pass certain condition defined in filter should be given to subscription.

For example, below is the message content json which is given as string,

"{"firstName": "Tony", "LastName": "Stark", "nickName": "Iron Man", "occupation":"actor"}"

How do i create a subscription rule that receives messages only for "occupation": "actor". As per azure documentation, we need to SqlFilter however but no luck till now,

https://learn.microsoft.com/en-us/azure/service-bus-messaging/topic-filters

https://www.terraform.io/docs/providers/azurerm/r/servicebus_subscription_rule.html#example-usage-sql-filter-

We are using terraform to create resource in azure cloud. Module suggested in above link, but how to define sql_filter to consider "occupation":"actor"

filter_type = "SqlFilter" sql_filter = "???"

I have tried as below, but got invalid character ":"

sql_filter = "'occupation':'actor'"

Author:Amit,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56804860/azure-topic-subscription-filter-subscription-rule
yy