C# – how to filter Azure Service Bus Queue messages based on a message property

azurecservicebus

I am using Azure Service Bus Queue to send emails out from my app. I have many different customers that send out emails via my app and each message gets a property that identifies that customer: CustomerID

I need to write an admin area for my customers to look at the pending message in the queue and more importantly see the deadletter queue. I do not want them to see everyones deadletters so I want to filter the messages based on the property CompanyID.

How do I accomplish this?

I read about topics and subscriptions but I add 10+ customers a week at least and this would not be a reasonable solution for me.

Best Answer

Queues do not support Filtering. You can write admin clients that get all messages and filter on the client end but consider Topics/Subscriptions because you can easily add up to 2000 Subscriptions per Topic and then filter messages in these by Customer etc. For things that you want to Query repeatedly on an approach as the one mentioned above, where you have a daemon parse the queue and update a table and then each customer runs queries on that status table would work better.

Related Topic