Interactive Data PlusFeed Input Adapter Sample

This sample demonstrates the use of the TIBCO StreamBase® Adapter for PlusFeed from Interactive Data (formerly known as the StreamBase Comstock Input Adapter).

Sample Location

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 Studio n.m Workspace\
      sample_adapter_embedded_interactive-data-plusfeed

Preparing to Run the Sample

  1. 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.

  2. 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.

Running This Sample in StreamBase Studio

  1. 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.

  2. Click the PlusFeed icon to open the StreamBase Properties view for the adapter.

  3. Click the Adapter Settings tab and enter values for the PlusFeed host, port, username, and password.

  4. Click the Edit Schema tab and optionally change the set of fields you would like to have appear in the market data output tuples.

  5. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  6. In the Test/Debug Perspective, open the Console view. If it is not already open: click WindowShow ViewOtherGeneralConsole. 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

  7. In the Manual Input view, select the SubscribeIn stream, and, in the Subscribe, Snapshot, Symbol, and SourceID fields, respectively, enter true, true, IDC, and 558. Note that the adapter treats flags containing null as false. Click Send Data.

  8. 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.

  9. In the Application Output view, select the SubscriptionsOut stream.

  10. In the Manual Input view, select the InfoQueryIn stream, enter ListSubscriptions and MyTag in the Command and Tag fields, respectively, and click Send Data.

  11. 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.

  12. In the Application Output view, select the UpdateOut stream.

  13. In the Manual Input view, select the SubscribeIn stream, and, in the Subscribe, Snapshot, Symbol, and SourceID fields, respectively, enter false, false, IDC, and 558. Then click Send Data.

  14. In the Application Output view, observe the series of update tuples emitted from the UpdateOut stream have stopped.

  15. In the Manual Input view, enqueue tuples containing ListErrorCodes, ListAvailableTokens, ListUserTokens, ListSourceIDs, and ListCurrencies commands, selecting the appropriate output stream in the Application Output view to see the results of each.

  16. When done, press F9 or click the Stop Running Application button.

Running This Sample in Terminal Windows

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.

  1. 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.

  2. 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.

  3. 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

  4. 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

  5. In window 2, type:

    sbc dequeue -v

    This window will display the tuples dequeued from the adapter's output ports.

  6. In window 3, type:

    echo true,true,false,false,IDC,558,null,null | sbc enqueue SubscribeIn

  7. In window 2, observe a snapshot tuple emitted from the SnapshotOut stream followed by a series of update tuples emitted from the UpdateOut stream.

  8. In window 3, type:

    echo ListSubscriptions,MyTag | sbc enqueue InfoQueryIn

  9. 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.

  10. In window 3, type:

    echo false,false,false,false,IDC,558,null,null | sbc enqueue SubscribeIn

  11. In window 2, observe the series of update tuples emitted from the UpdateOut stream have stopped.

  12. In window 3, enqueue tuples containing ListErrorCodes, ListAvailableTokens, ListUserTokens, ListSourceIDs, and ListCurrencies commands.

  13. In window 2, observe the results of the information query commands entered in the previous step.

  14. Type Ctrl-C in each windows 1 and 2 to stop the StreamBase application and the dequeuer.