I am trying to get the message Id of the currently processing message in a Queue in Azure web job. Couldn't find any proper documentation on how to get that.
public static void ProcessQueueMessage([QueueTrigger("%testingQueue%")] TestingMessageModel testMessage, TextWriter log)
{
// want to do some logging for this particular triggered message using the messageid. How to get that?
}
Adding the TestingMessageModel as a reference, it doesn't have any guid. I want to use the GUID that azure creates when a message is put into the queue.
public class TestingMessageModel
{
public int FromOrg {get; set;}
public DateTime BatchDate {get; set;}
public Payments[] payments {get; set;}
}
It supports to bind the id
directly, you could check my code.
public static void ProcessQueueMessage([QueueTrigger("myqueue")] string message,ILogger logger, string id)
{
logger.LogInformation(message);
logger.LogInformation($"{message}id={id}");
}
Hope this could help you.