Contents
Compliance is an example of a production-level StreamBase application that manages a stock portfolio and checks for compliance of buy transactions against a set of rules governing the exchange.
By default, the sample files are installed in:
-
On Windows:
C:\Program Files\StreamBase Systems\StreamBase.n.m\sample\compliance -
On UNIX:
/opt/streambase/sample/compliance
The Compliance Sample Application consists of:
-
The application,
compliance.sbapp -
A sample Java and C++ enqueuer to preload shared data in the application, using the StreamBase C++/Java Client API
-
A sample Java and C++ dequeuer to view the application's output, using the StreamBase C++/Java Client API
-
An sbfeedsim configuration file,
compliance.sbfs. -
Java and C++ source code for the above programs.
-
Either Microsoft Visual Studio .Net solution and project files (Windows) or a Makefile (UNIX) that can be used to (re)build all of the sample source code. (In the Visual Studio files, the paths to find StreamBase include files and libraries are configured to run from the installation directory.)
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click → .
-
Select this application from the Applications list.
-
Click OK.
StreamBase Studio creates a project for each sample.
Important
The compliance.sbapp application cannot be run in StreamBase
Studio, because it contains group-by
elements that are based on legacy (pre-3.7) feed simulations, which are
not supported in the new (3.7+) feed simulations. For this reason, the
procedures in this section use the sbfeedsim-old command to run the Compliance
sample in terminal windows.
-
Open three terminal windows. In each window, change directory to the installed compliance sample file location. For example:
cd /opt/streambase/sample/compliance. -
In the first terminal window, launch a StreamBase Server on compliance.sbapp:
sbd compliance.sbapp -
In the second terminal window, enter either of the following commands to run the preloader, and wait until it is done:
-
C++ version:
./preload -
Java version:
java -classpath `sb-config --classpath`:preload.jar com.streambase.sample.compliance.Preload
-
-
Still in the second terminal window, run the output viewer by entering either of these commands:
-
C++ version:
./outputviewer -
Java version:
java -classpath `sb-config --classpath`:outputviewer.jar com.streambase.sample.compliance.OutputViewer
-
-
In the third terminal window, run the sbfeedsim-old command on the legacy configuration file, suppressing the printout of tuples:
sbfeedsim-old -q compliance.sbfsNote
This legacy (pre-3.7) feed simulation contains
group-byelements that are not supported by the current Feed Simulator and its sbfeedsim command.
-
Open three StreamBase Command Prompt windows. In each window, change directory to the installed compliance sample file location. For example:
cd C:\Program Files\StreamBase Systems\StreamBase.n.m\sample\compliance -
In the first command window, launch a StreamBase Server on compliance.sbapp:
sbd compliance.sbapp -
In the second window, enter either of the following commands to run the preloader, and wait until it is done:
-
C++ version:
preload -
Java version:
java -classpath "streambase-install-dir\lib\sbclient.jar";preload.jar com.streambase.sample.compliance.Preload
-
-
Still in the second command window, run the output viewer:
-
C++ version: C++:
outputviewer -
Java version:
java -classpath "streambase-install-dir \lib\sbclient.jar;outputviewer.jar" com.streambase.sample.compliance.OutputViewerFor example:
java -classpath "C:\Program Files\StreamBase Systems\StreamBase.n.m\lib\sbclient.jar;outputviewer.jar" com.streambase.sample.compliance.OutputViewer
-
-
In the third command window, run the sbfeedsim-old command on the provided configuration file, suppressing the printout of tuples:
sbfeedsim-old -q compliance.sbfs
If the StreamBase Server is running on a different system,
use the option -u to specify the StreamBase Server URI (by
default, sb://localhost).
