.net - Azure 服务总线主题分区

标签 .net azure messaging azureservicebus azure-servicebus-topics

我正在尝试向一个主题发送消息,该主题是在选中启用重复检测启用分区选项的情况下创建的。我没有在我的 BrokeredMessage 实例上设置 SessionIdPartitionKey 属性。根据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.

在创建 BrokeredMessage 实例后,其 MessageId 属性会自动初始化,因此我希望分区能够正常工作。但事实并非如此:

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。 例如:

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

关于.net - Azure 服务总线主题分区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44845716/

相关文章:

c# - 流式传输到图像并返回

.net - 从 PDF 页面获取文本时出现 iTextSharp 异常 "Stack empty"

尝试将 OPC UA 数据写入云时,Azure OPC Publisher 显示 "no job received"

azure - 如何仅获取 Azure key 保管库的部分 Powershell 输出?

java - 使用 Java 应用程序向我的手机发送消息

messaging - 当我使用 NServiceBus 订阅消息时会发生什么?

c# - 有没有办法在 Switch 表达式中跳过或继续,或者每个分支都需要返回一些东西?

c# - 时间序列趋势数据的重采样、聚合和插值

c# - 如何将图像保存到 Azure Blob 并使用特定字段命名并返回 Blob Url 并将其保存到 .net core 2.2 中的数据库

api - Spread vs MPI vs Zeromq?