I've created an Azure Function that is triggered any time a new message is added to an Azure ServiceBus queue. With this code it works fine:
#r "Newtonsoft.Json"
#load "..\shared\person.csx"
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
public static void Run(string message, TraceWriter log)
{
var person = JsonConvert.DeserializeObject<Person>(message,
new JsonSerializerSettings() {ContractResolver = new CamelCasePropertyNamesContractResolver()});
log.Verbose($"From DeserializeObject: {person.FirstName} {person.LastName}");
}
I've seen that I can also bind the message to a POCO like that:
public static void Run(Person message, TraceWriter log)
{
log.Verbose($"From DeserializeObject: {message.FirstName} {message.LastName}");
}
Now I would like to bind the message to a BrokeredMessage
because I need to have access to the properties of the message.