A message selector is string that lets a client program specify a set of messages, based on the values of message headers and properties. A selector matches a message if, after substituting header and property values from the message into the selector string, the string evaluates to true
. Consumers can request that the server deliver only those messages that match a selector.
The syntax of selectors is based on a subset of SQL92 conditional expression syntax.
Identifiers can refer to the values of message headers and properties, but not to the message body. Identifiers are case-sensitive.
An identifier is a sequence of letters and digits, of any length, that begins with a letter. As in Java, the set of letters includes _
(underscore) and $
(dollar).
Certain names are exceptions, which cannot be used as identifiers. In particular, NULL
, TRUE
, FALSE
, NOT
, AND
, OR
, BETWEEN
, LIKE
, IN
, IS
, and ESCAPE
are defined to have special meaning in message selector syntax.
Identifiers refer either to message header names or property names. The type of an identifier in a message selector corresponds to the type of the header or property value. If an identifier refers to a header or property that does not exist in a message, its value is NULL
.
A string literal is enclosed in single quotes. To represent a single quote within a literal, use two single quotes; for example, 'literal''s'
. String literals use the Unicode character encoding. String literals are case sensitive.
An exact numeric literal is a numeric value without a decimal point, such as 57
, -957
, and +62
; numbers in the range of long
are supported.
An approximate numeric literal is a numeric value with a decimal point (such as 7.
, -95.7
, and +6.2
), or a numeric value in scientific notation (such as 7E3
and -57.9E2
); numbers in the range of double
are supported. Approximate literals use the floating-point literal syntax of the Java programming language.
The boolean literals are TRUE
and FALSE
(case insensitive).
Internal computations of expression values use a 3-value boolean logic similar to SQL. However, the final value of an expression is always either TRUE
or FALSE
never UNKNOWN
.
Every selector is a conditional expression. A selector that evaluates to true
matches the message; a selector that evaluates to false
or unknown does not match.
Arithmetic expressions are composed of numeric literals, identifiers (that evaluate to numeric literals), arithmetic operations, and smaller arithmetic expressions.
Conditional expressions are composed of comparison operations, logical operations, and smaller conditional expressions.
Order of evaluation is left-to-right, within precedence levels. Parentheses override this order.
Operator names are case-insensitive.
Logical operators in precedence order: NOT
, AND
, OR
.
Comparison operators: =
, >
, >=
, <
, <=
, <>
(not equal).
These operators can compare only values of comparable types. (Exact numeric values and approximate numerical values are comparable types.) Attempting to compare incomparable types yields false
. If either value in a comparison evaluates to NULL
, then the result is unknown (in SQL 3-valued logic).
Comparison of string values is restricted to =
and <>
. Two strings are equal if and only if they contain the same sequence of characters.
Comparison of boolean values is restricted to =
and <>
.
Arithmetic operators in precedence order:
Arithmetic operations obey numeric promotion rules of the Java programming language.
arithmetic-expr1
[NOT] BETWEEN
arithmetic-expr2
AND
arithmetic-expr3
The BETWEEN
comparison operator includes its endpoints. For example:
identifier
[NOT] IN (
string-literal1
,
string-literal2
,
...
)
The identifier
must evaluate to either a string or NULL
. If it is NULL
, then the value of this expression is unknown.
identifier
[NOT] LIKE
pattern-value
[ESCAPE
escape-character
]
The identifier
must evaluate to a string.
The pattern-value
is a string literal, in which some characters bear special meaning:
identifier
IS NULL
This comparison operator tests whether a message header is null, or a message property is absent.
identifier
IS NOT NULL
This comparison operator tests whether a message header or message property is non-null.
White space is any of the characters space, horizontal tab, form feed, or line terminatoror any contiguous run of characters in this set.
TIBCO Enterprise Message Service™ C and COBOL Reference System Release 4.3, February 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |