Nirvana - Event Filtering Guide
Nirvana's 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 Nirvana. The filtering capabilities described in this page are what is defined by the JMS filtering specification.
Nirvana filtering can be applied at two levels. The first is between client and server and the second is between server and server.
All Nirvana filtering is handled by the Nirvana server and therefore significantly reduces client overhead and network bandwidth consumption.
For more documentation on filtering functionality which above and beyond that available through the JMS specification please see the advanced filtering guide.
Basic Filtering
Each Nirvana 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 | ORCOMPARISON_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 '_' character to denote wilcard
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_'
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
For help more information on the available functions, please see the advanced filtering guide.
Additional references for event filtering, may be found within the JMS message selector section of the JMS 1.1. specification.
