Using the June 2012 Azure SDK, I have a service bus topic, and I am adding a subscription to it.
I want to filter that subscription. If I do this based on one of the items that I have added to the BrokeredMessage Properties bag, then this works fine:
// Send the message:
BrokeredMessage message = new BrokeredMessage(serializableObject);
message.Properties.Add("MySessionId", "GUID");
getTopicClient("MY_TOPIC").Send(message); // method creates client. omitted here.
// Retrieve it:
SqlFilter myFilter = new SqlFilter(@"(MySessionId = ""GUID"")");
namespaceManager.CreateSubscription("MY_TOPIC", "MY_SUB", myFilter);
SubscriptionClient client = getSubscriptionClient("MY_TOPIC", "MY_SUB"); // method creates client. omitted here.
// This will work fine:
Message newMessage = client.Receive();
If, however, I do the same, but add the filter value to one of the direct properties of the BrokeredMessage object, such as SessionId, then this fails:
// Send the message:
BrokeredMessage message = new BrokeredMessage(serializableObject);
message.SessionId = "GUID";
getTopicClient("MY_TOPIC").Send(message); // method creates client. omitted here.
// Retrieve it:
SqlFilter myFilter = new SqlFilter(@"(SessionId = ""GUID"")");
namespaceManager.CreateSubscription("MY_TOPIC", "MY_SUB", myFilter);
SubscriptionClient client = getSubscriptionClient("MY_TOPIC", "MY_SUB"); // method creates client. omitted here.
// This will never receive a message
Message newMessage = client.Receive();
How can I construct an SqlFilter that will address the built-in properties of the BrokeredMessage object (SessionId, or ReplyToSessionId, or MessageId?
Is this even possible?