Azure-docs: Setting the 'Label' property in a service bus message

Created on 12 Apr 2020  Â·  4Comments  Â·  Source: MicrosoftDocs/azure-docs


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Relating to an issue (#51668) , now resolved, regarding setting broker properties.

I am unable to set the 'Label' property in a service bus message.

Building on the code from from the previous feedback:

``
from azure.servicebus import ServiceBusClient, Message

CONNECTION_STR = ''
QUEUE_NAME = 'queue`'

Create SB client

sb_client = ServiceBusClient.from_connection_string(conn_str=CONNECTION_STR)

Create Queue sender

queue_sender = sb_client.get_queue(queue_name=QUEUE_NAME)

Build message

message = Message("{'data':'Hello World!'}")

Custom Properties

message.user_properties = {'Label': 'Shell.Energy.Europe.Power.Meter.Actual'}

Brokered Properties

message.properties.content_type = "application/json"
message.properties.label = "M4"

Send message

queue_sender.send(message)
``

The result is that the ContentType is set as "application/json", however the Label property remains empty. I am able to set other properties such as 'ReplyTo' so Am not sure why the Label can't be set this way too?

Any help is much appreciated, thanks

Pri3 cxp product-question service-bus-messaginsvc triaged

All 4 comments

Thanks for the feedback and bringing this to our notice . At this time we are reviewing the feedback and will update the document as appropriate .

Any update on this? thanks

I figured it out! instead of properties.label, it should be properties.subject

@izzy1993 Glad to hear that! We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulmarshall picture paulmarshall  Â·  3Comments

mrdfuse picture mrdfuse  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

bityob picture bityob  Â·  3Comments