0
votes

Is it possible to update a Topic programmatically on Azure ServiceBus?

I've tried something along the lines of the following:

var topicName = "myTopic";
var nsManager = NamespaceManager.Create();            

var topic = nsManager.TopicExists(topicName) 
? nsManager.GetTopic(topicName) 
: nsManager.CreateTopic(topicName);            

topic.RequiresDuplicateDetection = true;

nsManager.UpdateTopic(topic);

However this fails with ArgumentException and message containing '(400) Bad Request.'

It appears that UpdateTopic can only be used for altering the status of the topic, is this correct? Is there anyway for me to change the Dupe Detection settings without using the Dashboard?

1

1 Answers

0
votes

Short answer is: NO, you'll need to recreate the topic. Refer to this Stackoverflow question that deals with ServiceBus queues but essentially applies to your question just as well: How to change the properties of a service bus queue?