StreamBase provides data processing components called operators, each of which performs a specific type of runtime action on streaming data. These operators are highly configurable. You can define and modify them by using the graphical properties views in StreamBase Studio.
This topic lists each StreamBase operator, and describes its most commonly uses, as examples of the functionality you can implement. Operators can be applied to many different types of applications, and can be used in a variety of combinations (or query patterns).
For more information about defining each operator, click the links in the list.
- Aggregate Operator
-
Provide a view into data in a moving window, where you might want to compare, sum, average, or count that data. For example, you could:
-
Sum volumes of trades of a stock over 30 second intervals, in a field-based Aggregate operator.
-
Calculate a moving average of price for each of four successive trades of a given stock, in a tuple-based Aggregate operator.
-
- BSort Operator
-
Reorder tuples by using an approximate buffered sort. For example, you could reorder trades by time where they are potentially out of order.
- Filter Operator
-
Send tuples to different downstream branches based on tuple values, or remove from the streaming data those tuples with values that do not correspond to a defined set of values. For example, you could allow only those trades of 10000 shares or more to pass into a particular output stream
- Gather Operator
-
Combine tuples, by using a common key value, that were previously split up into separate branches. For example, you could gather together the results of tests performed on one trade (by
trade_id), and output the status of each individual test. - Heartbeat Operator
-
The Heartbeat operator adds timer tuples on the same stream with your data tuples, generally so that downstream operations can occur even if there is a lull in the incoming data. The Heartbeat operator detects late or missing tuples. Like the Metronome operator, it uses the system clock and emits output tuples periodically, but Heartbeat also calibrates the system clock using the input stream. The operator passes through any tuples on its input stream to the output stream, updating its internal clock. If an expected input tuple does not arrive within the configured interval plus a timeout, then the Heartbeat operator will synthesize a tuple with all null data fields except for the timestamp and emit it.
- Java Operator
-
You can add custom operators to a StreamBase application by dragging a Java Operator icon from the Palette to the EventFlow Editor's canvas. StreamBase Studio prompts you to specify the Java Archive (JAR) that contains the custom class(es) you already created, by extending the
com.streambase.sb.operator.Operatorclass. - Join Operator
-
Combine tuples where there can be more than one match per tuple. For example, you could generate an alert when trades in a given stock on Reuters and Comstock differ by more than a pre-set amount during any 60 second period.
- Lock and Unlock Operators
-
Process one tuple at a time through a section of the application, to achieve mutual exclusion. For example, you might use the Lock and Unlock pairs to ensure sequence coordination, or to protect shared data against concurrent writes, within the set of operators that reside between the starting Lock operator and the ending Unlock operator.
- Map Operator
-
Transform tuples by performing math or logical functions (such as a currency conversion), or remove or rename fields in your schema. For example, from a stream that contains stockname, symbol, description, volume, and price, you could use a Map operator to output a stream containing symbol, name, and cost.
- Pattern Operator
-
Apply pattern-matching queries across input streams. For example, detect when key events occur on one stream concurrently with sensitive operations on another stream.
- Merge Operator
-
Combine two streams into one with ordering by a field value (such as time). For example, you could interleave trades from two different feeds based on the time of the trade.
- Metronome Operator
-
The Metronome operator delivers output tuples periodically based on the system clock, at an interval you specify. In the same way a musician's metronome is used to indicate the exact tempo of a piece of music, you can use the StreamBase Metronome operator to control the timing of downstream operations by a connected component
- Query Operator
-
Reads from or writes to a Query Table. The Query Table can reside in-memory (data not persisted after server shutdown) or on-disk (data may persist between StreamBase Server sessions). The purpose of Query operators and Query Tables is to let you share data and maintain state across the StreamBase application. For example, you could look up the
NameandDescriptionof a stock, given its tickerSymbol. - Split Operator
-
You can insert a Split operator right after an upstream component that has a single output port and multiple output arcs, to explicitly indicate the order in which the outputs should be processed (to completion) by each set of downstream components.
- Union Operator
-
Combine two streams with the same schema into one stream, with no particular interleaving as in Merge. For example, you could interleave trades from two different feeds.
The following operator does not appear in the palette in StreamBase Studio. To use it, add its JAR file to the Java Build Path of your project.
- External Process Operator
-
The External Process Operator is a special-case operator that provides functionality for building applications with High Availability features. The operator provides a way for StreamBase applications to run external commands as if typed on the command line.
In addition to the topics listed above, see:
