是否可以在 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)错误请求”的消息而失败。
看来 UpdateTopic 只能用于更改主题的状态,这是正确的吗?无论如何,我是否可以在不使用仪表板的情况下更改重复检测设置?