ActivFeed Input Adapter Sample

This sample demonstrates the use of the TIBCO StreamBase® Adapter for Activ Financial.

Sample Location

By default, the sample files are installed in:

  • On Windows: C:\TIBCO\sb-cep\n.m\sample\activfeed

  • On UNIX: /opt/tibco/sb-cep/n.m/sample/activfeed

  • On Mac: /Applications/tibco StreamBase/n.m.x/sample/activfeed

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/activfeed
Windows:
  C:\Users\username\Documents\StreamBase Studio n.m Workspace\
      activfeed

Preparing to Run the Sample

  1. Obtain/edit the ServiceLocation.xml file for your Activ Content Gateway (ACG) server location, and determine 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.csv>. This file contains a number of 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 activfeed.sbapp application. Make sure the application is the currently active tab in the EventFlow Editor.

  2. Double-click the ActivFeed icon to open the StreamBase Properties view for the adapter.

  3. Click the Adapter Settings tab and enter values for the Activ ServiceLocation.xml pathname, username, and password file path names, and edit the uid.txt and pw.txt files with your ActivFeed account UserID and password, respectively. Also, edit or replace the ServiceLocation.xml file with entries that you have for your ActivFeed account. (Connect to the ActivFeed server that will provide data that matches your account type.)

  4. Optional: Edit the presubscribe.csv file with symbols and relationships of interest. Refer to Activ documentation for the symbology, relationship names (typical: NONE, OPTION, FUTURE) and table names ("all" is generally sufficient).

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

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

  7. In the Test/Debug Perspective, open the Console view. If it is not already open: click WindowShow ViewConsole. If the adapter connects successfully, you see a single message like the following:

    [notice] sbd at hostname:10000; pid=4568; Listening

  8. Optional (if not using the presubscribe.csv file): In the Manual Input view, select the subscribe stream, and, in the subscribe, fill in the command, symbol, relationships, and tables fields, respectively, enter subeq, MSFT.Q, NONE, and all. Then click Send Data.

  9. In the Application Output view, observe the tuples emitted from the MarketDataOutputStream stream.

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

  2. Edit the StreamBase 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 activfeed.sbapp

    If the adapter connects successfully to the CSP, you see a single message like the following:

    [notice] sbd at hostname:10000; pid=4568; Listening

  4. In window 2, type:

    sbc dequeue MarketDataOutputStream

    This window displays the tuples dequeued from the adapter's market data port.

  5. In window 3, type:

    sbc dequeue AdapterStatusMessages

    This window displays the tuples dequeued from the adapter's status port.

  6. In window 4, type:

    echo subeq,MSFT.Q,OPTION,all | sbc enqueue subscribe

  7. In window 2, observe the tuples emitted from the MarketDataOutputStream stream.

  8. In window 4, type:

    echo listsym,x,x,x | sbc enqueue subscribe

    echo listrels,x,x,x | sbc enqueue subscribe

    echo listtables,x,x,x | sbc enqueue subscribe

  9. In window 2, observe the information tuples listing all symbols received, all relationships you can use in subscriptions, and table names that can be used.

  10. In window 4, type the following command to terminate the server and dequeuers:

    sbadmin shutdown