Contents
This sample demonstrates a StreamBase application that processes financial tick data from three financial feeds. The application determines the fastest of the three feeds, computes useful statistics for each feed, and calculates the VWAP for the incoming tick data.
This sample is based on another sample included in the StreamBase
distribution, installed in . In the
FeedProc example, there are three input streams fed by a feed simulation. By contrast,
this sample uses three CSV Reader embedded adapters in place of the three input
streams. Please refer to FeedProc Sample for
more information about the application itself.
streambase-install-dir/sample/feedproc
The CSV Reader adapter and the sbfeedsim command share some characteristics. They both essentially read records from a CSV file and turn them into tuples. The CSV Reader runs in the same process space as the StreamBase application, while sbfeedsim runs as a separate process. Each of these approaches might be preferred under different circumstances.
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click → .
-
Select this sample from the Embedded Adapters list.
-
Click OK.
StreamBase Studio creates a single project containing the sample files.
By default, the sample files are installed in:
- On Windows
-
C:\Program Files\StreamBase Systems\StreamBase.n.m\sample\adapter\embedded\csvreader\ - On UNIX
-
/opt/streambase/sample/adapter/embedded/csvreader/
When you load the sample into StreamBase Studio, Studio copies the
sample project's files to your Studio workspace. StreamBase Systems
recommends that you use the workspace copy of the sample, especially on UNIX, where
you may not have write access to /opt/streambase. In
the default installation, the path to this sample in your Studio workspace is:
UNIX: ~/streambase-studio-n.m-workspace/sample_adapter_embedded_cvsreader Windows XP: C:\Documents and Settings\username\My Documents\StreamBase Studion.mWorkspace\ sample_adapter_embedded_cvsreader Windows Vista: C:\Users\username\Documents\StreamBase Studion.mWorkspace\ sample_adapter_embedded_cvsreader
-
In the Package Explorer, double-click to open the
feedproc.sbappapplication. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the
Run button. This opens the SB
Test/Debug perspective and starts the application.
-
The output is displayed in the Application Output view.
-
When done, press F9 or click the
Stop Running Application button.
This section describes how to run the sample in UNIX terminal windows or Windows command prompt windows. On Windows, be sure to use the StreamBase Command Prompt from the Start menu as described in the Test/Debug Guide, not the default command prompt.
-
Open two terminal windows on UNIX, or two StreamBase Command Prompts on Windows. In each window, navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above.
-
In window 1, launch a StreamBase Server on
feedproc.sbapp:sbd feedproc.sbapp -
In window 2, run the output viewer from the FeedProc sample by entering the following command. If you installed StreamBase in a non-default location, correct the paths in these sample lines:
- On UNIX
-
java -classpath `sb-config --classpath`:\ /opt/streambase/lib/sbclient.jar:\ /opt/streambase/sample/feedproc/FeedProc.jar FeedProc
- On Windows
-
set SB_HOME="C:\Program Files\StreamBase Systems\StreamBase.
n.m" java -classpath "%SB_HOME%\lib\sbclient.jar;%SB_HOME%\sample\feedproc\FeedProc.jar" FeedProc
Note
If you take a long time to start step 3, the FeedProc viewer might show empty results. In this case, restart the commands in both windows, starting step 3 within a few seconds of step 2.
-
To stop the sample:
-
Close the FeedProc viewer application window.
-
Issue the following command to shut down the sbd server:
sbadmin shutdown
-
