Wombat MAMA Output Adapter Sample

Introduction

This sample demonstrates the use of the TIBCO StreamBase® Output Adapter for Wombat MAMA. See Wombat MAMA Output Adapter for details on the structure and use of this adapter.

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top-level menu, select File>Import Samples and Community Content.

  • Enter wombat to narrow the list of options.

  • Select Wombat Mama publishing output adapter from the StreamBase Market Data Adapters category.

  • Click Import Now.

StreamBase Studio creates a project for this sample.

Running This Sample in StreamBase Studio

  1. To get this sample to typecheck you must specify the location of the MAMA SDK JAR file, which is typically named mamajni.jar. Follow these steps:

    1. In the Project Explorer view, right click this sample's top-level project folder and select Properties from the context menu.

    2. Select Java Build Path in the contents column.

    3. Select the Libraries tab.

    4. Click Add External JARs.

    5. Navigate to the location of and select the mamajni.jar file on your local file system.

    6. Click OK.

    7. Refresh the project's typecheck environment by pressing Ctrl+F5 or by selecting the project folder in the Project Explorer, right clicking, and selecting StreamBase>Refresh Project Typecheck Environment from the context menu.

    The MAMA API loads the transport configuration from a file named mama.properties, which should reside in a directory set in the WOMBAT_PATH environment variable. An example mama.properties file is available in sample_config/mama.properties. The publishing adapter's Middleware and Transport properties must match the properties set in mama.properties.

    In order for a MAMA client to receive data from the MAMA output adapter, it must use a transport complementary to the adapter's transport. The specific transport settings depend upon the middleware used. The file sample_config/mama.properties provides an example of two LBM transports that can be used together: trans_lbt_a and trans_lbt_b. The incoming and outgoing addresses of these transports are reversed; one's incoming channel is the other's outgoing channel.

    The sample includes several applications that demonstrate different usages of the adapter:

    JustPublish.sbapp

    Demonstrates publishing quotes from tuples enqueued to an Input Stream.

    MamaRepublishDynamicSubscribe.sbapp

    Demonstrates a republishing scenario in which messages are received from the MAMA input adapter and published on a different source by the MAMA output adapter.

    MamaRepublishPassthroughCache.sbapp

    Demonstrates a republishing scenario in which messages are passed between the MAMA input and output adapters via the passthrough cache.

  2. Double-click to open the sample application, JustPub.sbapp.

  3. Double-click on MamaOutput adapter. In the Properties view, select the Adapter Properties tab. Set the middleware and transport options to match those defined in your mama.properties file on WOMBAT_PATH.

  4. In the Adapter Properties tab, the source is set to an operator parameter called PUB_SOURCE. This parameter is defined in engine.conf. You can change the source to anything you like, but make note of the value for use with your subscribing MAMA client.

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

  6. In the Test/Debug Perspective, open the Manual Input view. Enter a quote for any symbol, set the MdMsgType to 1 (the Init msg).

  7. Open a shell on your system. Set the WOMBAT_PATH and system libraries path to be able to run a mamalistenc sample client provided by Wombat. Start mamalistenc as follows: mamalistenc -m [your middleware] -tport [the transport that will connect to publisher's transport] -S [source from MamaOutput adapter properties] -s [symbol for which you entered quote above] -dict_tport [transport to get dictionary, if running with feedhandler] -B [if no feed handler, run without dictionary]

  8. Observe the mamalistenc client receive the initial value for the symbol. Try to enter another quote for the same symbol in the Manual Input view in Studio. Observe an update in the mamalistenc output.

  9. When done, press F9 or click the Terminate EventFlow Fragment button.

Sample Location

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 permission problems. The default workspace location for this sample is:

studio-workspace/sample_adapter_embedded_wombat-mama-pub

See Default Installation Directories for the default location of studio-workspace on your system.