@ShilpaGopal Thanks for reaching out. Unfortunately, there is no equivalent method in python as per the reference document here as we have in C# for MessageQueue.ReceiveByCorrelationId.
The workaround in Python would be you can use the ServiceBusReceiver
class to receive messages from a Service Bus queue. You can use the receive_messages()
method to receive messages from the queue.
To receive the first message based on the correlation id when the second message arrives, you can use the peek_messages()
method to peek at the messages in the queue and then filter the messages based on the correlation id. Once you have the message that matches the correlation id, you can use the complete_message()
method to remove the message from the queue.
Feel free to provide the feedback/feature request in the Azure SDK for python repo here.
Please accept as "Yes" if the answer is helpful so that it can help others in the community. If you need any help/clarification/concerns/follow up questions, then please click on "Add Comment" on my answer and provide more details.