Package com.netflix.eventbus.filter.lang.infix Description
An infix notation based language for event filters. At a higher level, one creates an expression made out of multiple
"predicate"s chained together using the AND and OR operators.
Predicate
A predicate by definition is an expression that results in a boolean value. There are multiple
predicates available in the language which are described below. On top of these predicates one can also use
comparison functions, described below, which results in a boolean value.
Between Predicate:
A between predicate checks whether a value is between a lower and upper bound.
Example: "xpath("//a/b/c") between (100,150)". Here xpath() is a function which is described below.
This is only supported for numeric inputs.
In Predicate:
An in predicate checks whether a value is in a list of values provided to the function.
This is supported for alphanumeric inputs.
Example: "xpath("//a/b/c") in ("x", "y", "z")". Here xpath() is a function which is described below.
Null Predicate:
A null predicate checks whether the passed value is null.
Example: "xpath("//a/b/c") is null". Here xpath() is a function which is described below.
Regex Predicate:
A null predicate checks whether the passed value matches a provided regex.
Example: "xpath("//a/b/c") =~ """. Here xpath() is a function which is described below.
Exists Predicate:
A null predicate checks whether the passed value matches a provided regex.
Example: "xpath("//a/b/c") =~ """. Here xpath() is a function which is described below.
Comparison Functions
This language currently supports the following comparison functions:
- Equals:
Example: "xpath("//a/b/c") = "xyz". Here xpath() is a function which is described below.
- Not Equals:
Example: "xpath("//a/b/c") != "xyz". Here xpath() is a function which is described below.
- Greater than
Example: "xpath("//a/b/c") > "xyz". Here xpath() is a function which is described below.
- Greater than or equals
Example: "xpath("//a/b/c") >= "xyz". Here xpath() is a function which is described below.
- Lesser than
Example: "xpath("//a/b/c") < "xyz". Here xpath() is a function which is described below.
- Lesser than or equals
Example: "xpath("//a/b/c") <= "xyz". Here xpath() is a function which is described below.
All the above comparison functions are available only for numeric inputs.
XPath function
This primarily is the only function that fetches runtime values in the filters. The XPath
will be run on the event object for which the filter is applied. For details about the evaluation and support
see this
Other value functions
We also have certain functions that helps convert values in specific formats. These
functions are listed below:
- Time millis: Converts milliseconds since epoch to a date-time string. The format of date-time pattern is as
specified here
Example: "xpath("//a/b/c") = time-millis("yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856") . Here xpath() is a function which is described above.
- Time string: Converts a stringified time from one format to another. The format of date-time pattern is as
specified here
Example: "xpath("//a/b/c") = time-string("yyyy-MM-dd'T'hh:mm:ss:SSS","yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856") .
Here xpath() is a function which is described above.
First format argument is the target format.
Seconds format argument is the input source format.