I am working on an azure function V2 that peeks the messages from the service bus. In this function I would like to know the state of the messages (Active, Deferred, Scheduled)
I know that Microsoft.ServiceBus.Messaging.BrokeredMessage has a State property.
But I am using Microsoft.Azure.ServiceBus. So How do I get the state of Microsoft.Azure.ServiceBus.Message?
Just an example function that explains my need:
[FunctionName("GetStates")]
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = "getstates")] HttpRequest req, ILogger log)
{
var result = new Dictionary<string, int>() /** string: state, int: counter **/
receiver = new MessageReceiver("MyConnectionString", EntityNameHelper.FormatSubscriptionPath("MyTopic", "MySubscription"));
var messages = await receiver.PeekBySequenceNumberAsync(receiver.LastPeekedSequenceNumber, 50);
// How to get the states???
return new OkObjectResult(result);
}