c# - SQLFilter based on System Properties in Azure Service Bus Subscription -


i working on setting topic/subscription service, , need syntax of sqlfilter can access brokeredmessage properties, property. correct syntax on sql filter access system properties of message?

i have working example using tutorial can send , receive topic/subscriptions desired: https://azure.microsoft.com/en-us/documentation/articles/service-bus-queues-topics-subscriptions/

however, want setup sql filters each subscription based on property of brokeredmessage. tutorial followed mentions possible "when subscription created, can supply filter expression operates on properties of message, both system properties (for example, label) , custom application properties (for example, storename.)"

if set custom property, e.g. storename, this:

message.properties.add("storename", "testme"); 

and set subscription sql filter this:

namespacemanager.createsubscription("mynstesttopic", "testsubscription", new sqlfilter("storename = 'testme'")); 

the subscription filters expected. however, if try , use brokeredmessage objects property (or label matter) described in article, have been unable work. i've tried following sql filters no luck. correct syntax access system properties of message?

brokeredmessage message = new brokeredmessage();  message.to = "testme";    namespacemanager.createsubscription("mynstesttopic", "testsubscription", new sqlfilter("to = 'testme'"));  namespacemanager.createsubscription("mynstesttopic", "testsubscription", new sqlfilter("message.to= 'testme'"));  namespacemanager.createsubscription("mynstesttopic", "testsubscription", new sqlfilter("messageto= 'testme'"));  namespacemanager.createsubscription("mynstesttopic", "testsubscription", new sqlfilter("messageto= 'testme'"));

from article topic subscription filters:

sql filters - sqlfilter holds sql-like condition expression evaluated in broker against arriving messages' user-defined properties , system properties. all system properties (which properties explicitly listed on brokeredmessage class) must prefixed sys. in condition expression. sql subset implements testing existence of properties (exists), testing null-values (is null), logical not/and/or, relational operators, numeric arithmetic, , simple text pattern matching like.

so in case need create sqlfilter on sys.to property:

namespacemanager.createsubscription("mynstesttopic", "testsubscription",     new sqlfilter("sys.to = 'testme'")); 

Comments