Apama 10.7.2 | Developing Apama Applications | Developing Apama Applications in EPL | Working with Streams and Stream Queries | Using output from streams | Coassigning to sequences in stream listeners
 
Coassigning to sequences in stream listeners
Unlike event listeners, a stream query might generate multiple items for each external or routed event. This is usually due to a batched window (a window that is updated after every p seconds or after every m items arrive) or to a join operation on two streams. In this case, the correlator executes a stream listener action multiple times, once for each generated item.
In a stream query definition, a window defines the set of items from the input stream that the query operates on. See Adding window definitions to from and join clauses.
To execute the stream listener action only once, and coassign all generated items at once, specify a stream listener that coassigns to a sequence variable. The sequence must contain items of the same type as the stream. For example:
sequence<A> seqA;
from batchedEvents: seqA {
   /* seqA contains all events that arrive in this batch */
}