Expressions
Expressions are simply literals and identifiers assembled together using the various operators described before. A message selector must eventually evaluate to a Boolean value, so its combination of expressions must be structured to result in a Boolean value. Expressions can be grouped in a message selector using parentheses in order to control the order of evaluation.
Arithmetic expressions are composed of arithmetic operators used with numeric literals and identifier values. Arithmetic expressions can be combined to form compound arithmetic expressions. For example:
(userid + 10000) / (callerid - 10000)
Conditional expressions are made up of comparison and logical
operators used with numeric, string, or Boolean literals or
identifiers and evaluate to TRUE,
FALSE, or NULL (i.e., unknown). Conditional
expressions can also be combined to form compound conditional
expressions. For example:
(JMSType like '%Ack') AND ((userid + 10000) / (callerid - 10000) < 1.0)
Notice that, although the last example includes an arithmetic
expression “fragment,” [(userid + 10000) / (callerid - 1000)], it becomes part of a conditional
expression when used with a comparison operator with the numeric
literal 1.0.
Every complete message selector must be a conditional
expression. A message selector that evaluates to TRUE matches the message; one that evaluates
to FALSE or NULL does not match the message.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access