Contents
This sample demonstrates the use of the TIBCO StreamBase® Adapter for 29West LBM.
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
.
-
In the Package Explorer, double-click
29west-lbm.sbapp
. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
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
. -
In the Manual Input view, click
. Two additional tuples appear in the Application Output view from theSubscribeStatus
andMessagesReceived
streams indicating:-
The transport session for the default topic has begun.
-
An LBM message from the default topic was received.
-
-
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 your workspace copy of the sample, as described above.
-
In window 1, type:
sbd 29west-lbm.sbapp
-
In window 2, type:
sbc dequeue -v
This window will display the tuples dequeued from the application's output ports.
-
In window 3, start the simulated NYSE feed:
echo 1.23 | sbc enqueue PublishInSimple
-
Observe in windows 2 that tuples appear from the
SubscribeStatus
andMessagesReceived
streams. -
In window 3, type the following command to terminate the server and dequeuer:
sbadmin shutdown
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.
-
Start the Ultra Messaging store daemon,
umestored
, using theume-example-config.xml
configuration file shipped with this sample. -
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.
-
In the Package Explorer, double-click
persistence-source.sbapp
. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
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. -
Observe two "UME store registation" tuples on the
PublishStatus
stream indicating the source application,persistence-source.sbapp
has registered with the UME store,umestored
. -
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. -
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. -
Press F9 or click the Stop Running Application button to simulate a source failure.
-
Click the Run button to restart the source application.
-
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 thePublishStatus
stream reflect the new sequence number as well. -
When done, press F9 or click the Stop Running Application button.
-
Start the Ultra Messaging store daemon,
umestored
, using theume-example-config.xml
configuration file shipped with this sample. -
In the Package Explorer, double-click
persistence-receiver.sbapp
. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
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.
-
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. -
In the Manual Input view enter
false
in theSubscribe
field and clickSend Data
to simulate a receiver failure. -
Observe the stream of
MessagesReceived
tuples stop. Note the sequence number of the lastMessagesReceived
tuple. -
Click
Clear
to clear the displayed tuples in the Applicaton Output view. -
In the Manual Input view enter
true
in theSubscribe
field and clickSend Data
. -
Observe a burst of
MessagesReceived
tuples that were published during the receiver failure. Observe the sequence number of the firstMessagesReceived
tuple in the burst is one more than that of the last received message before the failure. -
In the Manual Input view enter
false
in theSubscribe
field and clickSend Data
to simulate another receiver failure. -
In the Manual Input view enter
true
in theSubscribe
field and zero in theRecoverySequenceNumber
field and clickSend Data
. -
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.
-
When done, press F9 or click the Stop Running Application button.
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click
→ . -
Select this sample from the Embedded Input Adapters list.
-
Click OK.
StreamBase Studio creates a single project containing the sample files.
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 default 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.