How to receive the message from service bus using Rest Api

Kumar, Vikas 20 Reputation points
2023-11-22T10:41:11.9533333+00:00

Hi,

I want to receive message from azure service bus using Rest api. I have used method https://learn.microsoft.com/en-us/rest/api/servicebus/peek-lock-message-non-destructive-read and able to see the first message in the subscription. Please suggest how i can get the latest message from the subscription and also how I can query the messages on the basis of some filters.

Thanks!

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
591 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 23,646 Reputation points
    2023-11-22T13:41:24.2466667+00:00

    @Kumar, Vikas Thanks for reaching out. As mentioned in the previous thread When using the Peek-Lock method to retrieve messages from a Service Bus topic subscription, the messages are processed in the order they were added to the subscription, following a First-In-First-Out (FIFO) model.

    Like with queues, filters cannot be used to select messages based on certain criteria or properties when using the Peek-Lock method with Service Bus topics/subscriptions. The Peek-Lock method retrieves the next available message from the subscription, but you must complete or abandon the message at the front of the subscription before you can access the next one.

    let me know incase of further queries, I would be happy to assist you.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.