Apama 10.15.0 | Developing Apama Applications | EPL Reference | Queries | Query input definition
 
Query input definition
In a query, the required inputs section must contain at least one input definition.
Syntax diagram for query input definition
An event type you specify must be parseable. See Type properties summary. Event type names can come from the root namespace, a using declaration, or a local package as specified in a package declaration.
Event filters are optional. Specifying a filter here determines which events are added to a query window. The rules for what you can specify for the event filter are the same as for what you can specify in an event template in EPL. See Event templates.
Specification of a key is optional, but rarely omitted. If there is no key specification, all events are in one partition. The correlator uses the key to partition events. Each partition is identified by a unique key value. Specify one or more fields that are in the input event type. One or two fields in a key is typical. Three fields in a key is unusual and rarely needed. More than three fields is discouraged. If you define more than one input in a query
*The number, type, and order of the key fields in each input definition must be the same.
*If the names of the key fields are not the same in each input definition, you must insert the as keyword to specify aliases so that the names match. For details, see About keys that have more than one field.
A retain clause or a within clause is required. Alternatively, you can specify both.
A retain clause indicates how many events to hold in the window. Follow the retain keyword with a positive integer. If you specify a negative integer or zero, it is a runtime error that terminates the query.
A within clause indicates the length of time that an event stays in the window. Follow the within keyword with a positive float expression or a time literal. If you specify a negative float value or zero it is a runtime error that terminates the query.
For information on other clauses, see Format of input definitions.
Examples:
inputs {
Withdrawal(amount > 500) key userId within 1 hour;
}
inputs {
APNR() key road within(150.0);
Accident() key roadName as road within(10.0);
}