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's application is a variation of the FeedProc sample included in the StreamBase distribution. 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. Refer to FeedProc Sample for more information on the application itself.
You can use the Java dequeuer program FeedProcGUI, provided as part of the FeedProc sample, to view the output from this sample. To do so, you must have the FeedProc sample loaded as a project in Studio, alongside this sample.
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 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.
-
Input streams are automatically fed by three instances of the CSV File Reader adapter. Output is displayed in the Application Output view, while error messages are displayed in the Console view.
-
Optional. Run the output viewer from the FeedProc sample. Open the Run History list as described in the FeedProc sample's documentation, and select the
FeedProcGUIlauncher. This runs theFeedProc.javaprogram, which opens a separate window with title FeedProc Sample, and connects to the StreamBase Server instance runningfeedproc.sbapp. -
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 your workspace copy of the sample, as described above.
-
In window 1, launch StreamBase Server running
feedproc.sbapp:sbd feedproc.sbapp -
In window 2, run a dequeuer:
sbc deqYou can optionally run separate dequeuers in separate windows:
sbc deq ITviewsbc deq Traderview -
To stop the sample, run
sbadmin shutdown.
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, select → .
-
In the search field, type
csv fileto narrow the list of samples. -
Select
CSV file input adapterfrom the StreamBase Standard Adapters category. -
Click OK.
StreamBase Studio creates a single project containing the sample files.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
StreamBase Systems strongly recommends that you load this sample in Studio, and use the workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids the permission problems that are
inevitable when trying to work with the installed location in C:\Program Files or /opt/streambase.
The default workspace location for this sample is:
studio-workspace/sample_adapter_embedded_csvreader
See Default Installation
Directories for the location of studio-workspace on your system.
In the default StreamBase installation, this sample's files are installed in:
streambase-install-dir/sample/adapter/embedded/csvreader
See Default Installation
Directories for the location of streambase-install-dir on your system. This location
usually requires administrator privileges for write access.
