azure - 相当于 Azure.Messaging.ServiceBus SDK 中的 "UserProperties"属性

标签 azure azureservicebus azure-sdk-.net

我正在尝试从旧版 Azure 服务总线 SDK 迁移到新的“Azure.Messaging.ServiceBus”。我没有看到与新的 Azure.Messaging.ServiceBus.ServiceBusMessage 等效的“UserProperties”属性。在哪里可以设置用户属性?我看到一个名为“ApplicationProperties”的属性。这是值得追求的吗?

Microsoft.Azure.ServiceBus.Message msg = new Microsoft.Azure.ServiceBus.Message(Encoding.UTF8.GetBytes(message.Body));

            if (message.Headers != null)
            {
                foreach (KeyValuePair<string, object> item in message.Headers)
                {
                    msg.UserProperties.Add(item.Key, item.Value); //I need help for this statement. 
                }
            }

最佳答案

是的,ApplicationProperties 是要使用的新自定义 header 集合。

关于azure - 相当于 Azure.Messaging.ServiceBus SDK 中的 "UserProperties"属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70326033/

相关文章:

相当于 RabbitMQ QoS 的 Azure 服务总线

azure - 如何处理来自某个主题的死信消息

c# - CloudBlockBlob 上传的非异步版本是否已弃用

azure - 无需使用 RDP 或任何其他第三方应用程序即可访问 Azure VM

asp.net - 动态阻止 Azure 云服务的 IP 地址

azure - 新的 Azure 服务总线库可以与之前的服务总线库一起使用吗?

c# - 如何从 Microsoft.Azure.Management.Fluent api 方法获得成功响应

azure - azure SDK 缺少 Microsoft.Threading.Tasks

json - 指导如何实际加密 APNS 的 JSON token

azure - 是否可以在客户端凭据流程中添加自定义声明?