python/lib/python3.5/site-packages/azure/servicebus/control_client/servicebusservice.py in send_topic_message(self, topic_name, message)
661 request.host = self._get_host()
662 request.path = '/' + _str(topic_name) + '/messages'
--> 663 request.headers = message.add_headers(request)
664 request.body = _get_request_body(message.body)
665 request.path, request.query = self._httpclient._update_request_uri_query(request) # pylint: disable=protected-access
AttributeError: 'Message' object has no attribute 'add_headers'
@annatisch could you take a look? Thanks!
@ctercekcsc - do you have an example of the code you were invoking that caused this error?
From the docs, the method is invoked as:
from azure.servicebus.control_client import Message
msg = Message(b'Hello World!')
sbs.send_topic_message('taskdiscussion', msg)
If you didn't construct a Message and instead tried to invoke this with another type, you would experience this.
We may want to add a type check and a bit better validation message here.
Note that there are two APIs inside this client library - an 'old' API that exists in the control_client namespace, and an new api. Thus azure.servicebus.Message != azure.servicebus.control_client.Message. This is a documentation error I"m going to fix up along with the validation.
Thanks @maggiepint using the correct Message class has fixed this issue for me, appears to definitely be a documentation issue!
Most helpful comment
Note that there are two APIs inside this client library - an 'old' API that exists in the
control_clientnamespace, and an new api. Thusazure.servicebus.Message != azure.servicebus.control_client.Message. This is a documentation error I"m going to fix up along with the validation.