BlazeDS Consumer Selector Gotcha

When working with Flex messaging, a Consumer component can filter the messages it receives using a selector. The selector uses SQL 92 syntax to filter against message headers, so if my messages contained a header named roomID I could write something like:

myConsumer.selector = "roomID = 1";

The problem I ran into today was that I wanted to filter on multiple values using an IN clause, however when I tried to do the following I got no messages:

myConsumer.selector = "roomID IN (1,2,3)";

Turns out that I needed to modify my IN statement to filter for string values as opposed to numeric values:

myConsumer.selector = "roomID IN ('1','2','3')";

This was a little confusing because I was able to filter on single values using numeric values, as in my first example above, but filtering on multiple values required string values. I'm using BlazeDS with ColdFusion, so I'm not sure if this is specific to my configuration, but if you run into issues trying to filter on numeric values using an IN clause, try using strings instead.

UPDATE: After further testing I'm not entirely sure that selectors work at all with the ColdFusion Event Gateway Adapter. I'm still trying to work this out, but right now the first example above doesn't seem to be working for me, even if I check for a string value. If anyone has experience using selectors with CF please let me know...

Related Blog Entries

Comments
sai's Gravatar Hey, did you get this thing to work? I've followed your advice. Later found out that it was not done. Please advice. thanks
# Posted By sai | 7/27/10 9:37 AM
Nathan Mische's Gravatar Selectors do not work at all in ColdFusion 8. This was fixed in ColdFusion 9.
# Posted By Nathan Mische | 7/27/10 9:40 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.