Azure Service Bus主题分区 [英] Azure Service Bus topics partitioning
问题描述
我正在尝试向创建了同时选中启用重复检测和启用分区选项的主题创建消息.我没有在BrokeredMessage
实例上设置SessionId
和PartitionKey
属性.根据此:>
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:
如果队列或主题具有 QueueDescription.RequiresDuplicateDetection属性设置为true和 BrokeredMessage.SessionId或BrokeredMessage.PartitionKey 属性未设置,则BrokeredMessage.MessageId属性 用作分区键.
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.
创建BrokeredMessage
的实例后,其MessageId
属性将自动初始化,因此我希望分区能够正常工作.但事实并非如此:
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:异常 执行函数时:Functions.ProcessQueueMessage2Async ---> System.InvalidOperationException:需要为所有会话设置SessionId 将消息代理到支持排序,主题的分区主题 名称= dev1-mtapp:Topic:response-topic〜255. TrackingId:5fbe5df2-8747-4053-ba79-c29a80e9d1ed_G25_B31, SystemTracker:dev1-mtapp:topic:response-topic〜255
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
我在哪里错了?
推荐答案
您应设置:
topicDescription.SupportOrdering = false.
例如:
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);
}
这篇关于Azure Service Bus主题分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!