29West LBM Adapter Sample

This sample demonstrates the use of the TIBCO StreamBase® Adapter for 29West LBM.

Running this Sample in StreamBase Studio

Note

This adapter requires access to the JAR file that implements the 29West LBM Java API on your system, and any files referenced by that JAR file. You will need to copy your site's LBM implementation version of that file, copy the file to $STREAMBASE_HOME/lib/ext.

  1. In the Project Explorer, double-click 29west-lbm.sbapp.

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

  3. In the Test/Debug Perspective, open the Application Output view. Observe a "Source Notification" tuple on the SubscribeStatus stream indicating the LBM publish adapter is ready to publish to the default topic, my.default.topic.

  4. In the Manual Input view, click Send Data. Two additional tuples appear in the Application Output view from the SubscribeStatus and MessagesReceived streams indicating:

    • The transport session for the default topic has begun.

    • An LBM message from the default topic was received.

  5. 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 your workspace copy of the sample, as described above.

  2. In window 1, type:

    sbd 29west-lbm.sbapp

  3. In window 2, type:

    sbc dequeue -v

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

  4. In window 3, start the simulated NYSE feed:

    echo 1.23 | sbc enqueue PublishInSimple

  5. Observe in windows 2 that tuples appear from the SubscribeStatus and MessagesReceived streams.

  6. In window 3, type the following command to terminate the server and dequeuer:

    sbadmin shutdown

Running the Persistence Sample

The sample includes a pair of StreamBase applications that illustrate the use of persistence in the LBM publish and subscribe adapters. The applications are run independently, first with the source run from StreamBase Studio and the receiver from a terminal window to demonstrate source recovery, then with the receiver run from StreamBase Studio and the source from a terminal window to demonstrate receiver recovery.

Source Recovery

  1. Start the Ultra Messaging store daemon, umestored, using the ume-example-config.xml configuration file shipped with this sample.

  2. Open a terminal windows on UNIX, or a StreamBase Command Prompts on Windows. Navigate to your workspace copy of the sample, as described above, and type:

    sbd -p 10001 persistence-receiver.sbapp

    Note

    The -p 10001 option is required to avoid a TCP port conflict, since StreamBase Studio's default server port is 10000.

  3. In the Project Explorer, double-click persistence-source.sbapp.

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

  5. In the Test/Debug Perspective, open the Application Output view. Observe a tuple on the SequenceNumberOut stream with a sequence number of 0, indicating the LBM publish adapter should begin publishing at sequence number 0, which corresponds to application message number 1.

  6. Observe two "UME store registation" tuples on the PublishStatus stream indicating the source application, persistence-source.sbapp has registered with the UME store, umestored.

  7. Observe two "Receiver connected" tuples on the PublishStatus stream indicating two receivers (umestored and persistence-receiver.sbapp) have connected to the topic being published to.

  8. Observe four message-related tuples on the PublishStatus stream each second indicating an outgoing message was assigned a sequence number, delivered to the receiver, stabilized in the store, and reclaimed by the Ultra Messaging library.

  9. Press F9 or click the Stop Running Application button to simulate a source failure.

  10. Click the Run button to restart the source application.

  11. Observe the same set of tuples as above, but notice the sequence number returned on the SequenceNumberOut stream is non-zero, and the source therefore resumes publishing at the point in the message stream it was at when it was shut down. Observe the message-related tuples on the PublishStatus stream reflect the new sequence number as well.

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

Receiver Recovery

  1. Start the Ultra Messaging store daemon, umestored, using the ume-example-config.xml configuration file shipped with this sample.

  2. In the Project Explorer, double-click persistence-receiver.sbapp.

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

  4. Open a terminal windows on UNIX, or a StreamBase Command Prompts on Windows. Navigate to your workspace copy of the sample, as described above, and type:

    sbd -p 10001 persistence-source.sbapp

    Note

    The -p 10001 option is required to avoid a TCP port conflict, since StreamBase Studio's default server port is 10000.

  5. In the Test/Debug Perspective, open the Application Output view. Observe a stream of tuples on the MessagesReceived stream containing the messages published by the source.

  6. In the Manual Input view enter false in the Subscribe field and click Send Data to simulate a receiver failure.

  7. Observe the stream of MessagesReceived tuples stop. Note the sequence number of the last MessagesReceived tuple.

  8. Click Clear to clear the displayed tuples in the Applicaton Output view.

  9. In the Manual Input view enter true in the Subscribe field and click Send Data.

  10. Observe a burst of MessagesReceived tuples that were published during the receiver failure. Observe the sequence number of the first MessagesReceived tuple in the burst is one more than that of the last received message before the failure.

  11. In the Manual Input view enter false in the Subscribe field and click Send Data to simulate another receiver failure.

  12. In the Manual Input view enter true in the Subscribe field and zero in the RecoverySequenceNumber field and click Send Data.

  13. Observe that the receiver now recovers the from the beginning of the message stream instead of from where it left off before the latest failure.

    Note

    Depending on the configuration of the UME store and the publish rate, the receiver may not be able to recover the enire message stream.

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

Importing This Sample into StreamBase Studio

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

  • From the top menu, click FileLoad StreamBase Sample.

  • Select this sample from the Embedded Input Adapters list.

  • Click OK.

StreamBase Studio creates a single project containing the sample files.

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_29west-lbm

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/29west-lbm

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