FluorineFx.NET

Filtering with message selectors

You can use a Consumer component's selector property to filter the messages that the component should receive. A message selector is a string that contains a SQL conditional expression based on the SQL92 conditional expression syntax. The Consumer component receives only messages with headers that match the selector criteria (based on message header values).

Adding extra information to a message

Include extra information for a message in the form of message headers. The headers of a message are contained in an associative array where the key is the header name

Actionscript code:

var message:AsyncMessage = new AsyncMessage();
message.headers = new Array();
message.headers["prop1"] = 5;
message.body = ...;
producer.send(message);
			

.NET code:

MessageBroker msgBroker = MessageBroker.GetMessageBroker(null);
AsyncMessage msg = new AsyncMessage();
msg.destination = ...;
msg.headers.Add("prop1", 5);
msg.clientId = Guid.NewGuid().ToString("D");
msg.messageId = Guid.NewGuid().ToString("D");
msg.timestamp = Environment.TickCount;
msg.body = ...;
msgBroker.RouteMessage(msg);			
			

Message Selectors

Message selectors cannot reference message body values. A message selector matches a message if the selector evaluates to true when the message's header field values and property values are substituted for their corresponding identifiers in the selector.

The order of evaluation of a message selector is from left to right within precedence level. Parentheses can be used to change this order.

Selector element Description Sample

Literals

String literals enclosed in single quotes

Exact numeric literal is a numeric value without a decimal point (57, -57)

Approximate numeric literal in scientific notation (-57.9E2), numeric value with a decimal (57.2)

Boolean literals TRUE and FALSE

Identifiers

Identifiers use the C# identifier syntax. They are case sensitive.

Identifiers cannot be the names NULL, TRUE, FALSE, NOT, AND, OR, BETWEEN, LIKE, IN, IS

Expressions

A selector is a conditional expression; a selector that evaluates to true matches; a selector that evaluates to false or unknown does not match

Standard bracketing () for ordering expression evaluation is supported

Logical operators in precedence order: NOT, AND, OR

Comparison operators: =, >, >=, <, <=, <> (not equal).

"p1 < 23"
"p1 = 1 OR p1 = 2"

Arithmetic operators

+, - unary

*, / multiplication and division

+, - addition and subtraction

BETWEEN

arithmetic-expr1 [NOT] BETWEEN arithmetic-expr2 AND arithmetic-expr3 comparison operator

"1 BETWEEN -1 AND 2"
"p1 BETWEEN -1 AND (2-5)"
"age BETWEEN 15 AND 19"

IN

identifier [NOT] IN (string-literal1, string-literal2,... ) comparison operator

"1 IN (1,2,3)"
"p1 NOT IN (1,2,3)"
"Country IN (' UK', 'US', 'France')"

LIKE

identifier [NOT] LIKE pattern-value [ESCAPE escape-character] comparison operator
Note: ESCAPE not supported

"phone LIKE '12%3'"

IS

Comparison operator tests for a null header field value

"user IS NOT NULL"