The StreamBase kit provides sample EventFlow applications to demonstrate key product features and to help you learn how to use them. Each sample has its own emphasis; for example, a sample may highlight a particular type of data processing operator, while another may describe the configuration details for a distributed environment. This topic describes the StreamBase samples, including their location and purpose, how we built them, and how to run them.
The StreamBase kit provides several types of samples to demonstrate the key product features. Each sample has its own emphasis; for example, a sample may highlight a particular type of data processing operator, while another may describe the configuration details for a distributed environment.
This group of samples includes EventFlow applications that focus on specific operators and data constructs, on business problems, and on configuration steps.
-
The Authentication Sample — Demonstrates what happens when you enable StreamBase authentication and then try to use several sb* StreamBase commands, such as sbadmin shutdown.
-
Best Bids and Asks Sample — Shows an example of a common stock trading application that tracks the highest bid price and lowest ask price for each stock.
-
BollingerBand Sample — Shows an example of a common analytical tool that provides a relative definition of high and low bands in securities trading.
-
Cluster Sample — Shows how the processing of operators in a StreamBase application can be distributed over multiple machines (using the concurrency option for module references or operators, and cluster features). To keep the scope simple, we only use two machines in this sample. However the feature supports the use of many more machines in a cluster, provided they are running the same version of StreamBase, the same operating system type, and the same architecture.
-
Compliance Sample — Shows an example of a common stock fund application, where the StreamBase operators are used to ensure that funds are in compliance with their business requirements.
-
Counter Sample — Demonstrates how to implement a counter to generate sequence numbers.
-
FeedProc Sample — Shows an example of application that processes financial tick data from three financial feeds, performing various useful computations on the data.
-
MACD Sample — Shows an example of a momentum indicator: a program that follows trends and shows the relationship between two moving averages of prices.
-
Operator and Data Construct Samples — Demonstrate how to include individual operators and data constructs in StreamBase applications.
These samples demonstrate how to work with the StreamBase-provided APIs to create client programs:
-
Buffering Sample — Highlights the tuple buffering options for "producer" or "enqueue" clients.
-
Client Sample — Provides sample enqueue and dequeue clients; that is, enqueuing (adding) tuples onto a named stream, and dequeuing (reading) processed tuples from a named stream. The samples include both Java or C++ sources.
-
StreamBase .NET Client Sample — Provides sample .NET enqueue, dequeue clients, and a monitor client that displays system, operator, and thread information.
StreamBase provides both input and output embedded adapters. Input
adapters convert data from external resources into StreamBase tuples,
while output adapters convert from StreamBase tuples to external
formats. Embedded adapters run in the same server process that is
hosting and processing your StreamBase application's requests. See
Adapters Guide
for descriptions of each adapter. Sample applications to illustrate the
use of embedded adapters are installed in STREAMBASE_HOME/sample/adapter/embedded.
The following pages illustrate how to run the embedded input adapters provided as part of the base StreamBase kit:
The following embedded input adapters are installed with separate installation kits:
The following adapter has characteristics of both input and output adapters, and installs from a separate installation kit:
The following pages illustrate how to run the embedded output adapters provided with the base StreamBase kit:
You can extend StreamBase by writing your own custom clients, functions, embedded adapters, and Java operators. The following samples are provided:
-
Custom Embedded Adapter Sample — illustrates the use of a custom-written embedded adapter.
-
Custom C++ Aggregate Functions Samples — demonstrates how to use a custom C++ aggregate function.
-
Custom Java Aggregate Function Sample — Contains an aggregating calljava function.
-
Custom Java Simple Function Sample — Contains a custom simple (non-aggregating) calljava function.
-
Custom C++ Simple Functions Sample — Demonstrates how to use a custom C++ simple (non-aggregating) function.
-
Java Operator Sample — Contains a StreamBase application and a StringCase class that extends
com.streambase.sb.streambase.operator. -
UTF-16 Sample — Demonstrates StreamBase's support for UTF-16 character data, and includes documentation about the
utf16custom Java functions.
The First Application Sample — Steps through the mechanics of using StreamBase Studio, defining a simple application, submitting generated test data to it, and observing the results. This is the same application you may have defined already while following the tutorial in the Getting Started With StreamBase Studio.
StreamBase Debugger Tutorial (sbdbtutorial) — Walks you through a debugging session and examines tuples in the Compliance sample.
By default, the StreamBase sample files are installed in:
-
On Windows:
C:\Program Files\StreamBase Systems\StreamBase.n.m\sample\... -
On UNIX:
/opt/streambase/sample/...
To load a sample into StreamBase Studio:
-
From the top menu, click →
-
Select one or more samples from the Load Sample Projects dialog.
For example:
StreamBase Studio creates a separate project for each sample. In the case
of the operator samples, one project is
created and all the individual operator's *.sbapp sample applications are imported into the same
project folder.
Notes
When you load a sample that contains a custom function or client into StreamBase Studio, Studio automatically sends any executable file and its configuration settings to StreamBase Server.
When you load a sample that contains JAR files, the JAR files are used when you run the sample; the Java source files are included only so that you can see the code. If you want to work on the Java source files and have StreamBase automatically build them as you work, you must add the StreamBase Client API to the project's Java build path. See StreamBase Project Properties for details.
A number of StreamBase samples, such as compliance and buffering, have C++ and Java code that can be
modified and rebuilt. In order to rebuild the C++ executables and Java
JAR files on Windows, configure Microsoft Visual Studio as follows:
-
Add the following StreamBase
includedirectories to the list of Include files in → → → :STREAMBASE_HOME\includeThe default location of STREAMBASE_HOME on Windows is:
C:\Program Files\StreamBase Systems\StreamBase.n.m -
Add the Sun JDK's
bindirectory to the list of executable files.For example, add the following folder to the list:
C:\Program Files\Java\jdk1.5.0_12\bin
