Azure Service Bus topics partitioning

こ雲淡風輕ζ 提交于 2020-01-04 05:49:27

问题


I'm trying to send a message to a topic which was created with both Enable duplicate detection and Enable partitioning options checked. I do not set SessionId and PartitionKey properties on my BrokeredMessage instance. According to this:

If the queue or topic has the QueueDescription.RequiresDuplicateDetection property set to true and the BrokeredMessage.SessionId or BrokeredMessage.PartitionKey properties are not set, then the BrokeredMessage.MessageId property serves as the partition key.

After I create an instance of BrokeredMessage its MessageId property is initialized automatically so I expect partitioning to work. But it does not:

Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.ProcessQueueMessage2Async ---> System.InvalidOperationException: SessionId needs to be set for all brokered messages to a Partitioned Topic that supports Ordering, Topic Name = dev1-mtapp:Topic:response-topic~255. TrackingId:5fbe5df2-8747-4053-ba79-c29a80e9d1ed_G25_B31, SystemTracker:dev1-mtapp:topic:response-topic~255

Where am I wrong?


回答1:


You should set: topicDescription.SupportOrdering = false. For example:

        if (!this.namespaceManager.TopicExists(topicName))
        {
            TopicDescription topicDescription = new TopicDescription(topicName);
            topicDescription.SupportOrdering = false;
            this.namespaceManager.CreateTopic(topicDescription);
        }


来源:https://stackoverflow.com/questions/44845716/azure-service-bus-topics-partitioning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!