Contents
StreamBase provides several components called data constructs that store information used by associated StreamBase operators:
- Query Table
-
A table structure within the StreamBase application for storing tuple values outside of a stream, enabling a StreamBase application to share data and maintaining state. One or more Query operators can write to (populate) or read from an associated Query Table.
Query Tables can be declared to reside in-memory, or on-disk. In the case of memory-resident Query Tables, any data stored in the table at runtime is not saved after the StreamBase Server is shut down. In the case of disk-based Query Tables, the data stored in the tables may persist between StreamBase Server sessions, provided that you defined a data directory. (Disk-based Query Tables are only available in StreamBase Enterprise Edition.)
- Working with Shared Query Tables
-
You can share StreamBase query tables within an application.
- Materialized Window
-
A view of tuples passing through an input stream (unlike other data constructs, which do not have input streams). The view can be based on a fixed number of tuples, a time interval, or a field value. You can then directly query the data using a (read-only) Query operator.
- JDBC Table
-
Connects a StreamBase application to a JDBC database. A Query operator can then query the JDBC database to maintain state and use its data in the application.
- Chronicle Connection
-
Connects a StreamBase application to any of the supported Chronicle data sources, if the Chronicle option is installed. A Query operator can then query the Chronicle database to maintain state and use its data in the application.
- Lock Set
-
A data construct associated a pair of Lock and Unlock operators.
Lock Sets are collections of locks that are used together by Lock and Unlock operator. A Lock Set has a (key) schema, and a specific set of values for the schema fields will reference exactly one lock. The purpose of using a Lock and Unlock operator together is to provide exclusive access for certain tuples to a sequence of operators. This generally comes up when dealing with operators that modify shared data structures, namely query Tables.
When a tuple enters a Lock operator, the expressions in the operator will be applied against the fields in the tuples. The expressions will generate a value X. Only one tuple that corresponds to the value X will be allowed past the Lock operator at any one time. All other tuples that evaluate to the value X will be buffered. Tuples that evaluate to values other than X will be allowed into the locked portion using the same rules. A locked portion of a StreamBase application may have multiple tuples, but the values they evaluate to must be distinct.
Important
Avoid using Lock and Unlock operators in deployed applications if at all possible. By their very nature they will impede performance of the StreamBase application. Lock and Unlock operators can be thought of in the same light as exclusive locks in a relational database. Database designers try to avoid the use of exclusive locks because they impede performance. Starting in StreamBase 3.0.0, you may be able to remove any existing Lock/Unlock pairs and Lock Sets from applications built with pre-3.0.0 StreamBase software. The Event Processing Platform in StreamBase provides a predictable execution order. This means that input tuples are each processed individually to completion, from left-to-right through a StreamBase EventFlow. There are exceptions to this general rule, as explained in the topic Execution Order, Concurrency, and Parallelism. Note that you may need to retain or add Lock, Unlock, and a Lock Set if the processing of the components between (and including) your Lock and Unlock operators is distributed across more than one module reference or physical machine.
To associate a Query operator with a Query Table, or a Lock Operator with a Lock Set, create an arc between the bottom port of the operator and the top port of the related data construct.
Note that a data construct can be associated with multiple operators, but an operator can be associated with only one data construct. For example, a Lock Set data construct can be associated with multiple pairs of Lock and Unlock operators, but each pair of Lock and Unlock operators be associated with only one Lock Set. Similarly, a Query Operator can only be associated with one Query Table, or JDBC Table data construct.
For more information about the properties that you can define for these data constructs and the operators they support, see the following topics:
