Reputation: 151
I need to add custom property for message that is autoforwarded from subscription. Value for new property should be subscription name. I have found that I can use subscription rule for adding new properties to message and I'm able to add some hardcoded value there but I can't find how to get subscription name.
Here is example how I'm setting new property with hardcoded value in rule:
SET user.originQueue = 'test'
I was looking here Subscription Rule SQL Action Syntax but I don't see how I can get the subscription name
Also is a way for preview subscription rule in azure portal? I can see only filters in portal. For now I'm using command line for verifying the rules.
Upvotes: 1
Views: 560
Reputation: 688
You can get the name using the administration client
using Azure.Messaging.ServiceBus.Administration;
var adminclient = new ServiceBusAdministrationClient(ServiceBusConnectionString);
SubscriptionProperties runtime = await adminclient.GetSubscriptionAsync(queueName, "subscription-test");
Console.WriteLine("This is the subscription name " + runtime.SubscriptionName);
Upvotes: 2