Home > Software design >  Equivalent of "UserProperties" property in Azure.Messaging.ServiceBus SDK
Equivalent of "UserProperties" property in Azure.Messaging.ServiceBus SDK

Time:12-13

I am trying to migrate from the Legacy Azure service bus SDK to the new one "Azure.Messaging.ServiceBus". I don't see the equivalent of the "UserProperties" property with the new Azure.Messaging.ServiceBus.ServiceBusMessage. Where can I set the user properties? I see a property called "ApplicationProperties". Is that the one to go for?

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. 
                }
            }

CodePudding user response:

Yes, ApplicationProperties is the new custom headers collection to use.

  • Related