Reputation: 2194
I am working my way through a great tutorial on using Azure PaaS and have come up with a question. Here is the tutorial if it helps anybody else (been pretty useful for me) https://youtu.be/ScJ4VxOmNGs
Is there a way outside of writing a C# program to check what filters are set on a Service Bus Topic Subscription Rule?
I can do this:
var rules = await processPaymentInventoryCheckedClient.GetRulesAsync();
And access them that way, but is there a way using CLI or Powershell? I know that as of the date of this post you cannot do it in the portal.
I tried using Service Bus Explorer, and it shows the rule but not the filter:
SBE is awesome btw, very helpful if you have not used it: https://github.com/paolosalvatori/ServiceBusExplorer
If I run the above C# code and then drill down into the properties I can verify that the filter is indeed applied:
Thank you --
Joe
Upvotes: 0
Views: 858
Reputation: 25994
Regarding ServiceBus Explorer - it's a bug. The tool currently only shows SqlFilter
s and not CorrelationFilter
s. I've raised an issue to add support for CorrelationFilter
s.
To list all filter you can use the following LinqPad script with a free version of the tool:
var connectionString = "<asb-connection-string>";
var topicPath = "<topic-path>";
var subName = "<subscription-name>";
var nsm = NamespaceManager.CreateFromConnectionString(connectionString);
foreach (RuleDescription rule in await nsm.GetRulesAsync(topicPath,subName))
{
if (rule.Filter is SqlFilter)
{
$"Rule: Name = {rule.Name} -
SqlExpression = {(rule.Filter as SqlFilter).SqlExpression}".Dump();
}
if (rule.Filter is CorrelationFilter)
{
$"Rule: Name = {rule.Name} - Correlate = {(rule.Filter as
CorrelationFilter)}".Dump();
}
}
Upvotes: 1