I am using a .NET Core application to send an object through an Azure Service Bus Queue and have it received by a Web Job (.NET Core as well.)
My question is how to
how to serialize/deserialize to send/receive the object?
Please refer to the demo code blow:
Send message:
var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(obj));
await queueClient.SendAsync(new Message { Body = body, ContentType = "text/plain" });
In the .net core WebJob
var body = Encoding.UTF8.GetString(message.Body);
var obj = JsonConvert.DeserializeObject(body);
Test Result: