Apama 10.15.0 | Developing Apama Applications | Developing Apama Applications in EPL | Defining Queries | Communication between monitors and queries
 
Communication between monitors and queries
Queries can be used with or without monitors written in EPL. The following statements can be used to send events between queries, or between queries and monitors or vice versa:
*route statement. A route statement from a query sends the event to be processed by other query instances. This is the recommended mechanism for sending events between queries. See also The route statement.
The route statement cannot be used to send events to a monitor.
*send...to statement. A send...to statement can be used to send an event to all Apama queries running on that correlator by sending it to the com.apama.queries channel or the default channel. To send the event to a monitor, send it to a channel the monitor is listening to. See also The send . . . to statement.
Note:
Queries receive events sent to the default channel, which is useful for testing.
The order in which events are processed is not guaranteed for queries. See Event ordering in queries.
In case the events are expected to be received by a monitor, the monitor author should make it clear which channel they are expecting events on. The channel name can be a single name for a given monitor or a name constructed from data in the event, so that different values are processed in parallel.
If you are using multiple correlators, be aware that communication between queries and monitors normally takes place within a single correlator. However, it is possible to use engine_connect or Universal Messaging to connect correlators. This allows an event sent on a channel on one correlator to be processed by a monitor subscribed to that channel on another correlator.
Unlike a query's history window, any state stored in EPL monitors, including in the listeners, is independent in each correlator, and is not automatically moved or shared between correlators.