Hello @Arjunmenon Unniparambathkalapurayil
If you're using the version 2x of the Functions runtime, the documentation does state the following in the Usage section:
These parameter types are for Azure Functions version 1.x; for 2.x and higher, use Message instead of BrokeredMessage.
As such, you'll want to use the Message
type and deserialize the message from byte stream to an appropriate POCO class/object in your project, like below:
public static class Receiver
{
[FunctionName("Receiver")]
public static void Run([ServiceBusTrigger("myqueue", Connection = "SBConnection")] Message myQueueItem, ILogger log)
{
log.LogInformation($"C# ServiceBus queue trigger function processed message");
Person person = JsonConvert.DeserializeObject<Person>(Encoding.UTF8.GetString(myQueueItem.Body));
log.LogInformation($"Name: {person.name} \n Age:{person.age}");
}
}
public class Person
{
public string name { get; set; }
public int age { get; set; }
}
With the example above, I can send a JSON payload of:
{
"name": "John Doe",
"age": "55"
}
and get a response in the log window:
The main reason behind the byte streams is to allow interoperability between different messaging protocols. For more info on this topic, please review: Payload serialization
Hope this helps - please let me know if you have any further questions.