Apama 10.3.1 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Working with Streams and Stream Queries | Defining stream queries
 
Defining stream queries
 
Linking stream queries together
Simple example of a stream network
Stream query definition syntax
Stream query processing flow
Specifying input streams in from clauses
Adding window definitions to from and join clauses
Joining two streams
Filtering items before projection
Generating query results
IEEE special values in stream query expressions
A stream query operates on one or two streams to transform their contents into a single output stream. A stream query definition declares an identifier for the items in the stream so that the item can be referred to by the operators in the stream query. Here is a simple stream query definition:
stream<integer> ints := from a in sA select a.i;
When the correlator executes a statement that contains a stream query definition, the correlator creates a new stream query. Each stream query has an output stream (the type of which might differ from that of the input stream).
A stream query definition is an expression that evaluates to a stream value. The value is a reference to the output stream of the generated query.
Following is an example of a simple stream query in a stream listener:
from a in sA select a.b as b {
doSomethingWith(b);
}
The following table describes the user-defined parts of this stream listener. It is important to understand the distinctive role each one serves.
Syntax Element
Description
a
This is an identifier that represents the current item in the stream being queried. See Specifying input streams in from clauses.
sA
This variable represents the stream being queried.
a.b
This expression describes what each query result looks like. In this example, the query produces outputs from the b field of the events in the stream.
b
This is the variable that you coassign the query results to so that the correlator can use the query result in the stream listener's code block.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.