I am subscribed to an Azure Service Bus Topic and I am trying to retrieve objects sent from my Python client. But in my receiving end all I get is something like this:
<__main__.User object at 0x02F694F0>
<models.AssetPayload object at 0x038EA930>
I have tried receiving in python and in .NET. Here is a dummy code of what I have tried:
class User(object):
def __init__(self, user_id, name):
self.user_id = user_id
self.name = name
user = User('123456', 'Shaphil')
# Send Message to 'myTopic'
msg = Message(bytes(user))
bus_service.send_topic_message('myTopic', msg)
# Receive Messages
msg = bus_service.receive_subscription_message('myTopic', 'AllMessages', peek_lock=False)
print msg.body
Receiving dummy code in C#:
var message = subscriptionClient.Receive();
var json = new StreamReader(message.GetBody<Stream>(), Encoding.UTF8).ReadToEnd();
Console.WriteLine(json);
How can I retrieve the User object (the user_id and name) that was sent by the sender?