Apama 10.15.5 | Developing Apama Applications | EPL Reference | Statements | Compound statements | The from statement
 
The from statement
The from statement is used to create a stream listener. A stream listener watches for items from a stream and passes output items to procedural code.
A from statement is similar to an on statement, which listens for events processed by the correlator and then executes an event listener action for each matching event or pattern. See The on statement.
You can assign the result of a from statement to a listener variable. This lets you call quit() on the stream listener.
A stream listener passes output items from a stream to procedural code. The stream, specified in the expression, can be a reference to an existing stream or a stream source template. Alternatively, it can be the stream created by an in-line stream query.
A colon and an identifier follow the expression or in-line stream query. This signifies a coassignment: when new items are available from the stream, the stream listener coassigns each output item to the specified variable.
The statement following the identifier can be a single EPL statement or a block of EPL statements. The from statement passes the output item to this statement or block and executes the statement or block once for each output item. If the output of the query is a lot that contains more than one item, and you want to execute the statement or block just once for the lot, coassign the output to a sequence. See Working with Streams and Stream Queries, and Working with lots that contain multiple items.