the latest sdk (Azure.Messaging.ServiceBus 7.0.1) doesn't seem to have the option to add custom(user) properties to a message (ie: for filtering topic subs). Has anyone found out how to do this now? SendMessageAsync
It was replaced by ServiceBusMessage.ApplicationProperties:
In v7, the userProperties and label on the message were renamed to applicationProperties and subject to be in sync with the AMQP spec. We did this across languages as part of our new SDKs.
We realize that we should have done a better job at communicating this in our migration guide which is linked from the readme for the package in npm and github as well as from our changelog. We will do so immediately.
https://github.com/Azure/azure-sdk-for-js/issues/12861#issuecomment-743406738
Adding on to @David's answer. This property is read-only hence you can't simply write:
message.ApplicationProperties = new Dictionary<string, object>();
In order to add your custom properties in this dictionary use:
ServiceBusMessage message = new ServiceBusMessage(content);
message.ApplicationProperties.Add("yourKey", "yourValue");
Please refer to this official GitHub documentation for further details around topic filtering.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With