Universal Messaging 10.3 | Concepts | Commonly Used Features | Events | Event Filtering
 
Event Filtering
Universal Messaging provides a server side filtering engine that allows events to be delivered to the client based on the content of values within the event dictionary.
This section introduces filtering and describes the basic syntax of the filtering engine, and provides examples to assist developers with designing the content of the events within Universal Messaging. The filtering capabilities described in this page are what is defined by the JMS standard.
Universal Messaging filtering can be applied at two levels. The first is between client and server and the second is between server and server.
All Universal Messaging filtering is handled by the Universal Messaging server and therefore significantly reduces client overhead and network bandwidth consumption.
For documentation on filtering functionality which extends beyond that available through the JMS standard please refer to the advanced filtering section (see Event Filtering using Selectors).
Basic Filtering
Each Universal Messaging event can contain an event dictionary as well as a byte array of data. Standard filtering, as defined by JMS, allows dictionary entries to be evaluated based on the value of the dictionary keys prior to delivering the data to the consumer.
The basic syntax of the filter strings is defined in the following notation :
EXPRESSION
where:
EXPRESSION ::=

<EXPRESSION> |
<EXPRESSION> <LOGICAL_OPERATOR> <EXPRESSION> |
<ARITHMETIC_EXPRESSION> |
<CONDITIONAL_EXPRESSION>

ARITHMETIC_EXPRESSION ::=

<ARITHMETIC_EXPRESSION> <ARITHMETIC_OPERATOR> <ARITHMETIC_EXPRESSION> |
<ELEMENT> <ARITHMETIC_OPERATOR> <ARITHMETIC_EXPRESSION> |
<ARITHMETIC_EXPRESSION> <ARITHMETIC_OPERATOR> <ELEMENT>

CONDITIONAL_EXPRESSION ::=

<ELEMENT> <COMPARISON_OPERATOR> <ELEMENT> |
<ELEMENT> <LOGICAL_OPERATOR> <COMPARISON_OPERATOR> <ELEMENT>

ELEMENT ::=

<DICTIONARY_KEY> |
<NUMERIC_LITERAL> |
<LOGICAL_LITERAL> |
<STRING_LITERAL> |
<FUNCTION>

LOGICAL_OPERATOR ::= NOT | AND | OR

COMPARISON_OPERATOR ::= <> | > | < | = | LIKE | BETWEEN | IN

ARITHMETIC_OPERATOR ::= + | - | / | *

DICTIONARY_KEY ::= The value of the dictionary entry with the specified key

LOGICAL_LITERAL ::= TRUE | FALSE

STRING_LITERAL ::= <STRING_LITERAL> <SEPARATOR> <STRING_LITERAL> |
Any string value, or if using LIKE,
use the '_' wildcard character to denote exactly one character
or the "%" wildcard character to denote zero or more characters.

NUMERIC_LITERAL ::= Any valid numeric value

SEPARATOR ::= ,

FUNCTION ::= <NOW> | <EVENTDATA> | DISTANCE
The above notation thus gives rise to the creation of any of the following valid example selector expressions :

size BETWEEN 10.0 AND 12.0

country IN ('uk', 'us', 'de', 'fr', 'es' ) AND size BETWEEN 14 AND 16

country LIKE 'u_' OR country LIKE '_e_'

country LIKE 'Can%'

country NOT LIKE '%nada'

size + 2 = 10 AND country NOT IN ('us', 'de', 'fr', 'es')

size / 2 = 10 OR size * 2 = 20

size - 2 = 8

size * 2 = 20

price - discount < 10.0 AND ((discount / price) * price) < 0.4
Additional references for event filtering may be found within the JMS message selector section of the JMS standard.