是否可以在Azure ServiceBus上以编程方式更新主题?
我尝试过以下几点:
var topicName = "myTopic";
var nsManager = NamespaceManager.Create();
var topic = nsManager.TopicExists(topicName)
? nsManager.GetTopic(topicName)
: nsManager.CreateTopic(topicName);
topic.RequiresDuplicateDetection = true;
nsManager.UpdateTopic(topic);
但是,ArgumentException和包含'(400)Bad Request。'的消息失败了。
看来UpdateTopic只能用于改变主题的状态,这是正确的吗?我是否还在不使用仪表板的情况下更改Dupe Detection设置?
答案 0 :(得分:0)
简短回答是:不,你需要重新创建主题。请参阅处理ServiceBus队列的Stackoverflow问题,但基本上也适用于您的问题: How to change the properties of a service bus queue?