0

I have an acceptance project in .netcore Framework where I create a new subscription and add a new rule using support classes of Microsoft.Azure.ServiceBus reference. Later i receive message from the same subscription.

Problem statement: Before i create a new subscription, I delete the old one using, client.DeleteSubscriptionAsync , i have verified while debugging the subscription gets deleted properly. Then i create a new subscription using client.CreateSubscriptionAsync(new SubscriptionDescription(TopicName, sub)).Result; , a new subscription gets created with a default rule of 1=1. Then i try to delete the default rule using client.DeleteRuleAsync(TopicName, subscriptionDetails.SubscriptionName, "$Default");

I have verified while debugging the Rule gets deleted properly.

And then finally I create a new rule using client.CreateRuleAsync(TopicName, sub, new RuleDescription("Rule1", new SqlFilter("XYZ"))).Result;

before this statement execution gets over, i'm getting an error saying that "Rule1" already exists and my test fails, but weird thing is the statement creates the rule and somehow throws the error as well. not sure why this is happening!

free to suggestions!

Rudra
  • 1

1 Answers1

0

Issue resolved, seems like client.CreateRuleAsync scans through whole topic for the existence of rule with same name (eg, Rule1) instead of just scanning the subscription, and if it finds a similar rule with same name, it throws the exception and fails the execution. Changing the rule name for specific condition resolved it.

Rudra
  • 1