Contents
This sample uses a Join operator to combine trades from a Reuters and the Interactive Data PlusFeed (formerly Comstock), where
the stocks are the same and the price per share is greater than or equal to $1, over a period of 60 seconds. The input streams
contain the fields Symbol
, PricePS_R
(per share), and Time
.
-
In the Package Explorer, double-click to open the
Join.sbapp
application. 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.
-
In the Application Output view, select the
JoinOut
output stream. No output is displayed at this point, but the dequeuer is prepared to receive output. This view will eventually show the output of the application. -
In the Manual Input view, select the
ReutersIn
input stream. -
Enter
intc
,23.0
, and10
in the Symbol_R, PricePS_R, and Time_R fields, respectively. -
Click
, and observe that no output is displayed yet in the Application Output view. -
Select the
ComstockIn
input stream. -
Enter
intc
,23.5
, and20
in the Symbol_C, PricePS_C, and Time_C fields, respectively. -
Click
, and observe that no output is displayed yet in the Application Output view. -
Select the
ReutersIn
input stream. -
Enter
intc
,24.5
, and30
in the Symbol_R, PricePS_R, and Time_R fields, respectively. -
Click
, and observe this data appears in the Application Output viewDeltaPricePS=1.0, PricePS_R=24.5, PricePS_C=23.5, Time_R=30
-
Select the
ComstockIn
input stream. -
Enter
amat
,34.5
, and40
in the Symbol_C, PricePS_C, and Time_C fields, respectively. -
Click
, and observe that no further output is displayed yet in the Application Output view. -
Enter
intc
,26.5
, and50
in the Symbol_C, PricePS_C, and Time_C fields, respectively. -
Click
, and observe this data appears in the Application Output viewDeltaPricePS=-3.5, PricePS_R=23.0, PricePS_C=26.5, Time_R=10 DeltaPricePS=-2.0, PricePS_R=24.5, PricePS_C=26.5, Time_R=30
-
Select the
ReutersIn
input stream. -
Enter
amat
,32.5
, and60
in the Symbol_R, PricePS_R, and Time_R fields, respectively -
Click
, and observe this data appears in the Application Output viewDeltaPricePS=-2.0, PricePS_R=32.5, PricePS_C=34.5, Time_R=60
-
Select the
ComstockIn
input stream. -
Enter
intc
,27.5
, and100
in the Symbol_C, PricePS_C, and Time_C fields, respectively. -
Click
, and observe that no further output is displayed yet 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 four terminal windows on UNIX, or four 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, enter:
sbd Join.sbapp
A message indicates that the StreamBase Server is listening and waiting for tuples.
-
In window 2, enter:
sbc dequeue JoinOut
No output is displayed at this point, but the dequeuer is prepared to receive output. This window will eventually show the output of the application.
-
In window 3, enter:
sbc enqueue ComstockIn
The sbc command is now awaiting keyboard input.
-
In window 4, enter:
sbc enqueue ReutersIn
The sbc command is now awaiting keyboard input.
-
In window 4, enter:
intc, 23.0, 10
No output is displayed yet in the dequeue window.
-
In window 3, enter:
intc, 23.5, 20
No output is displayed yet in the dequeue window.
-
In window 4, enter:
intc, 24.5, 30
Observe this output in the dequeue window:
1,24.5,23.5,30
-
In window 3, enter:
amat, 34.5, 40
No further output is displayed yet in the dequeue window.
-
In window 3, enter:
intc, 26.5, 50
Observe this output in the dequeue window:
-3.5,23,26.5,10 -2,24.5,26.5,30
-
In window 4, enter:
amat, 32.5, 60
Observe this output in the dequeue window:
-2,32.5,34.5,60
-
In window 3, enter:
intc, 27.5, 100
No output is displayed yet in the dequeue window.
-
In window 2, type: Ctrl+Z (Windows) or Ctrl+D (UNIX) to exit the sbc session.
-
In window 3, type the following command to terminate the server and dequeuer:
sbadmin shutdown
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click
→ . -
Select operator from the Data Constructs and Operators category.
-
Click OK.
StreamBase Studio creates a single project for the operator samples.
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
Load this sample in StreamBase Studio, and thereafter use the Studio 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 can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:
studio-workspace
/sample_operator
See Default Installation Directories for the location of studio-workspace
on your system.
In the default TIBCO StreamBase installation, this sample's files are initially installed in:
streambase-install-dir
/sample/operator
See Default Installation Directories for the default location of studio-workspace
on your system.