A tuple is a stream data element that consists of a combination of data values and a time value (timestamp).
For example, for temperatures observed at observation sites 1 (ID: 1) and 2 (ID: 2), the following figure compares data items, which have only values, with tuples, which combine both values and time.
Figure 2-2 Comparison of data items, which have only values, with tuples, which combine both values and time
By setting a timestamp indicating the observation time to each tuple as shown in the figure, data can be processed as stream data, rather than handled simply as temperature information from each observation site.
There are two ways to set the tuple's timestamp: the server mode method, where the timestamp is set based on the time the tuple arrives at the stream data processing engine, and the data source mode method, where the timestamp is set at the time that the data was generated. Use the data source mode when you want to process stream data sequentially based on the time information in the data source, such as when you perform log analysis.
The following subsections explain each mode.
The mode in which the tuple's timestamp is set to the system time of the server on which Stream Data Platform - AF runs when the tuple is read by the stream data processing engine is called the server mode. The following figure shows a timestamp being set in the server mode.
Figure 2-3 A timestamp being set in the server mode
In the server mode, Stream Data Platform - AF assigns the server time to each tuple, regardless of whether the input data already has a timestamp.
If time information is being written in the data by the data source from which data is being collected, the mode in which that time information in the tuples is used is called the data source mode. The following figure shows a timestamp being set in the data source mode.
Figure 2-4 A timestamp being set in the data source mode
In the data source mode, the timestamp already in the input data is used for each tuple.
Note that, if you perform stream data processing in the data source mode, the data has to be queued in the order specified by the timestamps. If the potential exists for the stream data to contain a timestamp error, see the information about how to queue timestamps in order in the uCosminexus Stream Data Platform - Application Framework Setup and Operation Guide.