I have written an Azure function (2.0). I am trying to consume a queue message (brokered message) like below.
FunctionName("ConsumeQueueMessage")]
public static async Task InitiateQueueHandling([ServiceBusTrigger("queueName", Connection = "AzureServiceBus")]BrokeredMessage queueMessage, ILogger log)
{
log.LogInformation($"HTTP trigger function starting processing campaign seek request at : {DateTime.Now}.");
But when i run it locally I am getting an error like this
Microsoft.Azure.WebJobs.Host: Exception binding parameter 'queueMessage'. Microsoft.Azure.WebJobs.Host: Binding parameters to complex objects (such as 'BrokeredMessage') uses Json.NET serialization.
- Bind the parameter type as 'string' instead of 'BrokeredMessage' to get the raw values and avoid JSON deserialization, or
- Change the queue payload to be valid json. The JSON parser failed: Unexpected character encountered while parsing value: @. Path '', line 0, position 0.
Queue message is created as below
var message = new BrokeredMessage(objWrapper);
message.Properties["message"] = JsonConvert.SerializeObject(objWrapper.Message);
message.Properties["messageType"] = objWrapper.Type.ToString();