Developing Apama Applications > Developing Apama Applications in EPL > Working with Streams and Stream Queries > Defining streams
Defining streams
You can use a stream variable to reference a stream. A stream variable declaration has the following form:
stream<type> name
Replace type with the type of the items in the stream. This can be any Apama type.
Replace name with an identifier for the stream. For example:
stream<Tick> ticks;
A stream variable can be a field in an event. However, you cannot route, enqueue, or send an event that contains a stream variable field.
There are two ways to create a stream:
*From an event template. See Creating streams from event templates.
*From the result of a stream query on some other stream. See Defining stream queries.
To obtain a reference to an existing stream, you must assign from or clone another stream value.
An inert stream never generates any output. There are a number of ways to create an inert stream including, but not limited to, the following:
*Calling new on a stream type or a type that contains a stream
*Declaring a global variable of stream type, or a type that contains a stream
*Spawning a monitor instance that contains a stream value
Note: It is permissible to define a stream variable that references a stream of stream type items. In such a definition, be sure to insert a space between the consecutive right-angle brackets. For example: stream<stream<float> >. You must insert this extra space in all stream definitions that contain a type that encloses another type. For example: stream<sequence<integer> >.
Copyright © 2013-2015 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.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.