Streams and tuples

A stream is a sequence of data that flows between operators in a stream application.

A stream can be infinite, such as traffic data. Alternatively, a stream can be finite like the contents of a file. When a streams application contains streams with infinite data, the application runs continuously without ending.

The individual pieces of data within a stream are called tuples which typically represent the state of something at a point in time. For example, a quote from a stock ticker or a reading from a temperature sensor.

A tuple is comprised of a sequence of ordered attributes. An attribute is a named value, and each attribute has a data type. The ordered collection of attribute data types is considered the tuple type.

The following diagram outlines the various components of a stream. The boxes represent tuples lined up in a row. The row of tuples represents a stream. A single tuple is enlarged to show a list of attributes with unique names and values. A list of attribute types is specified outside of the enlarged box. The collection of data types represents the tuple type.

Figure 1. Stream components


In the example above, one attribute for a tuple has the name "symbol", it is a string type, and its value be "IBM". A second attribute has the name "value", it is a decimal type, and its value is "241.82". The overall tuple can be represented like this "{ symbol="IBM", value=241.82 }". A second tuple on this stream may look like this: "{ symbol="NVDA", value=108.92 }". The tuple type for this example could be represented by tuple<string symbol, decimal value>