I already wrote a blog post about Azure ServiceBus filters which contains the basics of ServiceBus filters and how to use them (Azure ServiceBus filters). It describes most of the filters, but it does not contain how to work with datetime filters. The reason for it is, that datetime filters need to be set programmatically via C#, Powershell or others. The very nice and useful tool ServiceBus explorer also doesn’t support datetime filters and therefore it’s not so easy to test them. So let’s at first see how a standard filter looks like:
A “standard” filter in servicebus looks like:
sys.label LIKE ‘%bus%’
A datetime filter must be set via C# and looks like:
var filter = new SqlFilter("datetime >= @datetime");
In an Azure ServiceBus you can create multiple subscriptions for one topic. Such a subscription has the possibility to filter messages. So only the messages that match the criterias are “forwarded” to the subscription. Let’s have look on how filters work.
In this post I will use the ServiceBus Explorer to connect to an existing ServiceBus namespace. If you want to know how to create a ServiceBus namespace, a topic plus subscription and connect to it with the ServiceBus explorer – then read my previous blog post about it: How to create a topic with testdata in Azure ServiceBus
In this blogpost I will describe how to create a ServiceBus and a Topic in Microsoft Azure and how to push some sample data with the ServiceBus Explorer to it. In a following post I will describe how to work with ServiceBus filters.
Before you create the servicebus, you should download the servicebus explorer tool which you can find here: https://code.msdn.microsoft.com/windowsapps/Service-Bus-Explorer-f2abca5a
When you connect to Azure, e.g. the Azure ServiceBus Explorer to the ServiceBus (https://code.msdn.microsoft.com/windowsapps/Service-Bus-Explorer-f2abca5a), you will probably deal with proxy issues. I sometimes got the following error:
An error occurred attempting to access the account:
The remote server returned an error (407): Proxy Authentication Required