Streams
Streams represent time series data. Therefore, each stream has a timestamp and additional fields. A ThingWorx stream is a list of activities from things or data associated with Things. A stream can be thought of as a table structure with five predefined fields and any number of user-defined fields. Every stream entry has the following included fields:
• Timestamp
The time the entry was created. It is also possible to provide a timestamp when adding a stream entry.
|
The timestamp is a key field for streams. If you add an entry with the same timestamp, it will overwrite the previous timestamp (upsert). To avoid overwriting, specify milliseconds for the timestamp.
|
• Tag
Each stream entry can have data tags. Data tags help to search for and consume specific run time data.
• Source
The source of the stream entry. This is usually the name of the Thing writing to the stream or an identifier of an external system. There is an established relationship between a stream and its source. This is part of the built-in searchable relationships that are an artifact of the model.
• SourceType
The entity type of the source
• Location
The location of the stream entry's source
|
In PostgreSQL, stream entries are keyed by the unique key entries of the timestamp and source.
|
In addition to the included fields, additional fields can be configured. A ThingWorx Data Shape defines the additional fields. These field values are referred to as stream values.
This also drives the StreamEntries, StreamData, and StreamEntriesWithData services. In these services,
• StreamEntries: the default fields
• StreamData: the Data Shape fields
• StreamEntriesWithData: all the fields in the stream