I am trying to pass a list of Messages to Service Bus via the Python SDK and I get a 400 response as JSON is not in required format.
I am doing something like this and it fails:
messages = [Message({'id':1,'name':'bob'}),Message({'id':2,'name':'bill'})]
sb.send_queue_message_batch('queue_name', messages)
If I do this it works:
messages = [Message('bob'),Message('bill')]
sb.send_queue_message_batch('queue_name', messages)
Or if I call send_queue_message individually like this it works
sb.send_queue_message('queue_name', Message({'id':1,'name':'bob'}))
sb.send_queue_message('queue_name', Message({'id':2,'name':'bill'}))
Looking at the source it calls a method on the message to create the format expected in a batch so not sure what I should be doing differently. Unfortunately all examples of batch I can find are the simple string approach.
The consumer at the other end will be a .Net app so I need to ensure it can still be deserialised. I could call json.dump on the message content and pass it as a stringified version of the body but that does not sound like the ideal solution.
Thanks
SDK Source for batch: https://github.com/Azure/azure-sdk-for-python/blob/587bc9a2f955f43c67b02c537521f31aa4c27555/azure-servicebus/azure/servicebus/servicebusservice.py#L892