Contents
This sample demonstrates the use of the TIBCO StreamBase® Adapter for PlusFeed from Interactive Data (formerly known as the StreamBase Comstock Input Adapter).
By default, the sample files are installed in:
-
On Windows:
C:\TIBCO\sb-cep\
n.m
\sample\adapter\embedded\interactive-data-plusfeed -
On UNIX:
/opt/tibco/sb-cep/
n.m
/sample/adapter/embedded/interactive-data-plusfeed -
On Mac:
/Applications/tibco StreamBase/
n.m.x
/sample/adapter/embedded/interactive-data-plusfeed
When you load the sample into StreamBase Studio, Studio copies the sample project's
files to your Studio workspace. TIBCO recommends that you use the workspace copy of
the sample, especially on UNIX, where you may not have write access to /opt/tibco/sb-cep
. In the default installation, the path to this
sample in your Studio workspace is:
UNIX and Mac: $HOME/Documents/streambase-studio-n.m
-workspace/ sample_adapter_embedded_interactive-data-plusfeed Windows: C:\Users\username
\Documents\StreamBase Studion.m
Workspace\ sample_adapter_embedded_interactive-data-plusfeed
-
Determine the host name or IP address and TCP port number of your PlusFeed Client Site Processor (CSP) along with the username and password to access it.
-
If you want to subscribe to one or more symbols when the adapter starts, add the appropriate lines to the initial subscription file,
<initial_subscriptions.txt>
. This file contains a number of commented-out example subscriptions you can use as a starting point.
-
In the Package Explorer, double-click to open the
plusfeed.sbapp
application. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the PlusFeed icon to open the StreamBase Properties view for the adapter.
-
Click the Adapter Settings tab and enter values for the PlusFeed host, port, username, and password.
-
Click the Edit Schema tab and optionally change the set of fields you would like to have appear in the market data output tuples.
-
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
In the Test/Debug Perspective, open the Console view. If it is not already open: click
→ → → → . If the adapter connects successfully to the CSP, you should see a single message, such as that shown below:[notice] sbd at hostname:10000; pid=4568; Listening
-
In the Manual Input view, select the SubscribeIn stream, and, in the
Subscribe
,Snapshot
,Symbol
, andSourceID
fields, respectively, entertrue
,true
,IDC
, and558
. Note that the adapter treats flags containingnull
asfalse
. Click . -
In the Application Output view, observe a snapshot tuple emitted from the SnapshotOut stream followed by a series of update tuples emitted from the UpdateOut stream.
-
In the Application Output view, select the SubscriptionsOut stream.
-
In the Manual Input view, select the InfoQueryIn stream, enter
ListSubscriptions
andMyTag
in theCommand
andTag
fields, respectively, and click . -
In the Application Output view, observe a tuple emitted from the SubscriptionsOut stream containing information describing the active subscription entered above. A second tuple containing all nulls marks the end of the subscription list tuple stream.
-
In the Application Output view, select the UpdateOut stream.
-
In the Manual Input view, select the SubscribeIn stream, and, in the
Subscribe
,Snapshot
,Symbol
, andSourceID
fields, respectively, enterfalse
,false
,IDC
, and558
. Then click . -
In the Application Output view, observe the series of update tuples emitted from the UpdateOut stream have stopped.
-
In the Manual Input view, enqueue tuples containing
ListErrorCodes
,ListAvailableTokens
,ListUserTokens
,ListSourceIDs
, andListCurrencies
commands, selecting the appropriate output stream in the Application Output view to see the results of each. -
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 three terminal windows on UNIX, or three 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.
-
Edit the server configuration file,
sbd.sbconf
, replacing the placeholder host, port, username, and password values at the bottom of the file with the actual values for your site. -
In window 1, type:
sbd -f sbd.sbconf plusfeed.sbapp
If the adapter connects successfully to the CSP, you should see a single message, such as that shown below:
[notice] sbd at hostname:10000; pid=4568; Listening
-
In window 1, type:
sbd plusfeed.sbapp
If the adapter connects successfully to the CSP, you should see a single message, such as that shown below:
[notice] sbd at hostname:10000; pid=4568; Listening
-
In window 2, type:
sbc dequeue -v
This window will display the tuples dequeued from the adapter's output ports.
-
In window 3, type:
echo true,true,false,false,IDC,558,null,null | sbc enqueue SubscribeIn
-
In window 2, observe a snapshot tuple emitted from the SnapshotOut stream followed by a series of update tuples emitted from the UpdateOut stream.
-
In window 3, type:
echo ListSubscriptions,MyTag | sbc enqueue InfoQueryIn
-
In windows 2, observe a tuple emitted from the SubscriptionsOut stream containing information describing the active subscription entered above. A second tuple containing all nulls marks the end of the subscription list tuple stream.
-
In window 3, type:
echo false,false,false,false,IDC,558,null,null | sbc enqueue SubscribeIn
-
In window 2, observe the series of update tuples emitted from the UpdateOut stream have stopped.
-
In window 3, enqueue tuples containing
ListErrorCodes
,ListAvailableTokens
,ListUserTokens
,ListSourceIDs
, andListCurrencies
commands. -
In window 2, observe the results of the information query commands entered in the previous step.
-
Type Ctrl-C in each windows 1 and 2 to stop the StreamBase application and the dequeuer.