I'm little confused between BrokeredMessage Body Vs message.Properties ?
I want to insert message into queue and based on message want to trigger Webjob
What is the Difference between BrokeredMessage Body Vs message.Properties ?
example
// Create message, passing a string message for the body
BrokeredMessage message = new BrokeredMessage("Test message " + i);
// Set some addtional custom app-specific properties
message.Properties["EventId"] = i;
When I retrieve data from Queue
Console.WriteLine("Body: " + message.GetBody<string>());
Console.WriteLine("Test Property: " +
message.Properties["EventId"]);
Can any one elaborate more on difference ?
Properties is a simple key-value pair collection. In most cases you can use it to send information if you can map them as key-value pair of course. Body is the payload of the message that can be empty if you send your information content using only Properties (as above). If you need to send data encoded in a specific application format (ex. JSON, XML, ...) you have to use the Body. The same is for sending binary data ... you need to use Body. The advantage of Body (using Azure SDK) is the serializing feature; you can serialize a business logic class (or from your model) in the Body using a serializer (JSON/XML).
Paolo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With