Syntax Element | Description |
query name | Specify the query keyword followed by a name for your query. Like monitors and event types, the identifier you specify as the name of a query must be unique within your application. |
metadata | The metadata section is optional. If you specify a metadata section, it must be the first section in the query. Metadata are specified as a list of key-value pairs. Both key and value must be string literals. For more information, see
Defining metadata in a query. |
parameters | The parameters section is optional. If you specify a parameters section, it must follow the metadata section, if there is one, and precede the inputs section. Parameters must be of the following types: integer decimal float string boolean Specify one or more data_type parameter_name pairs. The parameter name can use any of the characters allowed for EPL identifiers (see
Identifiers). Any parameters you specify are available throughout the rest of the query. For more information about parameters and how parameters get their values, see
Implementing parameterized queries. |
inputs | The inputs section is required and it must follow the parameters section, if there is one, and precede the find statement. In the inputs section, you must define at least one input. If you specify more than one input each input must be a different event type. The inputs section specifies the events that the query operates on. An input definition can include the keyword, key, followed by one or more fields in the specified event. This is the query key. The correlator uses the key to partition incoming events into separate windows. For example, the cardNumber key indicates that there is a separate window for the Withdrawal events for each card number. In other words, each window can contain Withdrawal events associated with only one account. For details, see
Defining query input. |
find statement | After the inputs section, you must specify a find statement. A find statement specifies the event pattern of interest and a block that contains procedural code. This code can define EPL actions you want to perform when there is a match. For more information, see
Finding and acting on event patterns. |
action_definition | After the find statement, you can optionally specify one or more actions in the same form as in EPL monitors. An expression in a find statement can reference an action defined in that query. See
Defining actions in queries. |