Working with Streams and Stream Queries
EPL lets you create two kinds of queries:
Self-contained queries are processing elements that communicate with other self-contained queries, and with their environment, by receiving and sending events. Self-contained queries are designed to be multithreaded and to scale across machines. A self-contained query is sometimes referred to as an Apama query. This kind of query is defined in a
.qry file, which cannot contain a monitor. See
Defining Queries.
Stream queries operate on streams of items to generate more valuable streams that contain derived items. Stream queries are defined in monitors. The following topics provide information about stream queries.
In stream queries, derived items can be events, location types or simple types (boolean, decimal, float, integer, string). You can use standard relational operations, such as filters, joins, aggregation, and projection, to generate items. For example, you can define a query that converts a stream of raw tick data into a stream of volume-weighted average price (VWAP) items.
Stream-based language elements allow operations that refine events to be expressed more clearly and concisely than when using procedural language constructs such as event listeners. In particular, applications that need to calculate one value based on multiple items from an input stream are simpler and more efficient when written with stream queries.
Apama provides sample code that uses streams and stream queries in the
samples\monitorscript directory of your Apama installation directory. See also:
EPL Streams: A Quick Tour.