This is my code i used for connecting my RaspBerryPi to the Windows Azure Service Bus
import sys
from proton import *
#This code is for initiating the AMQP messenger
amqpmng = Messenger()
amqpmng._set_timeout(2000L) #Set timeout for sending and receiving at 2000 ms
address = "amqp://owner:<longpassword>@<namespace>.servicebus.windows.net/<queuename>"
#This code is for creating messages
msg = Message()
msg.subject = "This is a testmessage"
msg.body = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
#This code is for sending messages
try:
msg.address = address
amqpmng.put(msg)
amqpmng.send()
except:
e = sys.exc_info()[0]
print e, "Waited for 2s to send messages, nothing send, connection timed out"
amqpmng.stop();
#This code is for receiving messages
amqpmng.subscribe(address)
amqpmng.start()
try:
amqpmng.recv(1) #receive exactly 1 message (you can enter any value)
msg = Message()
while amqpmng.incoming > 0:
amqpmng.get(msg)
print(msg.body)
except:
e = sys.exc_info()[0]
print e, "Waited for 2s to receive messages, nothing received, connection timed out"
amqpmng.stop()
Also the message class only have two methods who takes data as parameter.
message.decode(data)
message.load(data)
I think you should use the message.load(data).
Also what i understand from the API reference is that the message.properties is using the python class dict for mapping his class properties.
Let me know if it was helpful!