Operator and Data Construct Samples

Overview

This section introduces the samples for using operators and data constructs found in the Palette view in StreamBase Studio.

An operator is a StreamBase processing unit that performs pre-defined work on streaming data, such as aggregating windows of data streams, merging streams, or retrieving shared data from a table. A data construct is a component that can store information from a stream or from an external data source that can then be used by an associated StreamBase operator.

A good way to learn about these StreamBase components is to go through the individual samples listed here.

Operators

Aggregate Operator:
BSort Operator Sample

Uses a Bsort operator to reorder trades by time for an input stream where trades arrive in random order. It is instructive to compare the results of running this application with 2 passes versus 6 passes.

Filter Operator Sample

Uses a Filter operator to pass only trades of 10,000 shares or more.

Gather Operator Sample

Uses a Gather operator to generate an alarm (a "true") for trades of 10,000 shares or more for a stock whose price is $200 or greater.

Heartbeat Operator:
  • Heartbeat Aggregate Sample: Uses a Heartbeat operator to output the number of stock quotes received every five seconds. The actual counting is done by an Aggregate operator, but it relies on the Heartbeat to trigger output during periods when no quotes are received.

  • Heartbeat Merge Sample: Uses two Heartbeat operators to prevent a Merge operator from starving when either of its inputs stop receiving tuples.

Join Operator Sample

Uses a Join operator to combine trades from a Reuters and a Comstock feed, where the stocks are the same and the price per share is greater than or equal to $1, over a period of 60 seconds.

Java Operator

An example of using the Java operator is described in Java Operator Sample.

Lock and Unlock Operators Sample

Uses paired Lock and Unlock operator to protect shared data against concurrent writes. The sample is intended only to demonstrate how to protect the data, and does not include other concurrent operations which might access the data. Other concurrent operations could derive from data on different streams sharing the Query Table, or they could be generated by tuples on the same stream, which would have to wait for the tuple being protected by the Lock clearing the Unlock. (There would be additional operator between the Lock and Unlock operator to process the data.) This example uses the same key for both the key into the Query Table and the key on which to lock for exclusive access.

Map Operator Sample

Uses a Map operator to accept tuples from a comma-separated list, and demonstrates the use of the Map operator to reorder and drop output fields, as well as calculate new output fields.

Merge Operator Sample

Uses a Merge operator to interlace trades from a Reuters and a Comstock feed, based on trade time.

Metronome Operator Sample

Uses a Metronome operator to output the current share price of all stocks every five seconds. The current prices are stored in a query table.

Pattern Operator Sample

Uses a Pattern operator to pass in only market data for securities that have already been traded.

Query Sample

Uses a Query Table data construct and Query operators to provide lookup capabilities for the name and description of a stock in the Nasdaq100 index, given its symbol.

Sequence Operator Sample

Uses a Sequence operator to generate unique ID numbers for generic product orders, allowing for easy querying when updating orders.

Split Operator Sample

Uses a Split operator to explicitly declare the order in which copies of a tuple are processed by downstream components. This type of configuration is seen when a component has a single output port, with multiple output arcs connected to separate downstream paths.

Union Operator Sample

Uses a Union operator to interlace trades from a Reuters and a Comstock feed.

Data Constructs

JDBC Table Data Construct Sample

Contains a JDBC data construct and several Query operators that perform operations on an assumed external Derby database.

Materialized Window Data Construct Sample

Uses a Materialized Window data construct to view and query data.