Using StreamBase Operators

Introduction

StreamBase provides data processing components called operators, each of which performs a specific type of runtime action on the data streaming through it. These operators are highly configurable. You can define and modify each instance of an operator using that instance's Properties view in StreamBase Studio.

Standard Operators

The operators in this section appear in the Operator drawer of the Palette view in StreamBase Studio.

For more information about defining and using each operator, click the links in the list.

Aggregate Operator

Provides 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

Reorders tuples by using an approximate buffered sort. For example, you could reorder trades by time where they are potentially out of order.

Filter Operator

Sends tuples to different downstream branches based on tuple values, or remove from the stream any 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

Combines tuples, 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, and output the status of each individual test.

Heartbeat Operator

Adds timer tuples on the same stream as 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 sends any tuples on its input stream through to the output stream, updating its internal clock for each tuple. If an expected input tuple does not arrive within the configured interval plus a timeout period, then the Heartbeat operator synthesizes a tuple with all null data fields (except for the timestamp) and emits it.

Join Operator

Combines 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

Processes 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

Transforms 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.

Merge Operator

Combines 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

Delivers output tuples periodically based on the system clock, at an interval you specify. In the same way musicians use a metronome 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.

Pattern Operator

Applies pattern-matching queries across input streams. For example, you can detect when key events occur on one stream concurrently with sensitive operations on another stream.

Query Operator

Reads from or writes to a Query Table. The Query Table can reside in memory (where the data is not persisted after server shutdown) or on disk (where the data can 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, or between containers.

Sequence Operator

Adds a field to each passing tuple, which field contains a unique identifier generated for that tuple. You can use the identifier field downstream as required by your application, such as to generate a keyword for tuples before storing them in a Query Table.

Split Operator

Splits its incoming stream into two or more outgoing streams that execute in a guaranteed specific order. Each incoming tuple is sent first to output port 1, then to output port 2, and so on. By contrast, you can also form a split by drawing multiple arcs from operator output ports. However, in this case, the order in which tuples proceed out multiple arcs is not known and not guaranteed. By using a Split operator, you can obtain a guaranteed processing order.

Union Operator

Combines 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.

Global Java Operators

The operators in this section appear in the Global Operators & Adapters drawer of the Palette view in StreamBase Studio. Both versions of the External Process operator are described in a single topic, External Process Operators.

Both External Process operators provide a way for StreamBase applications to run external commands as if typed on the command line. This functionality is especially useful in high availability application scenarios, where an HA monitoring application in one container might need to send a command to an application in another container or to another server to restart or change leadership status of the other application.

External Process Operator

This is a global Java operator that provides a way for StreamBase applications to run external commands by specifying each command and command option in a table.

External Process Command Line Operator

This is a global Java operator that provides a way for StreamBase applications to run external commands by specifying the command line to be run as a StreamBase expression string. The advantage of this version is that you can use expressions to calculate, increment, or augment portions of the command line argument strings.

Related Topics

In addition to the topics listed above, see:

Back to Top ^