Contents
This sample uses the LiveView adapters to query, publish, delete, and create tables on a running LiveView server from an EventFlow application. This sample assumes you are running the Hello World LiveView sample on localhost. There is a module parameter called LIVEVIEW_URI that you can change so all the adapters point to a different LiveView server.
-
First, load and run the Hello LiveView sample as delivered with LiveView.
-
Start StreamBase Studio in the SB Authoring perspective.
-
Load the Hello LiveView sample.
-
Select
→ from Studio's top-level menu. -
In the search field, enter
Hello
to narrow the list of samples. -
Select the Hello LiveView sample from the TIBCO Live Datamart list.
-
Click OK.
The Hello LiveView sample loads into Studio with the project name
sample_lv-helloliveview
. -
-
In the Package Explorer view, select the name of the project, right-click, and from the context menu, select
→ . The Console view shows several messages as the LiveView Server compiles the project and starts. Wait until the console messageAll tables have been loaded. LiveView is ready to accept client connections
before proceeding to the next step.
-
-
In the Package Explorer view, navigate back the to the sample_adapter_embedded_lv-sbd folder and double-click to open the
lv2sbd.sbapp
application. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
In the Application Output view, observe the tuples output by the various streams.
-
The ReadyStatus, QueryStatus, PublishStatus, DeleteStatus, and CreateDropStatus streams all show the LiveView Server status as CONNECTED.
-
The QueryStatus stream shows the status of the two preconfigured queries:
select * from ItemsSales where category=='book' select avg(LastSoldPrice) as AvgSoldPrice, category from ItemsSales where true group by category
-
The QueryOut stream shows the output from the first query.
-
The AggQueryOut stream show the output from the second query.
-
-
Using the QueryIn, PublishIn, DeleteIn, CreateDropIn streams you can register additional queries, publish data, delete data, or create or drop tables on the configured LiveView server. See the individual adapter documentation for what all the individual fields mean on these input streams.
-
When done, press F9 or click the Stop Running Application button to stop the EventFlow application and click the the red square Terminate button in the Console View's toolbar to stop the LiveView Server sessions.
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 window 1, navigate to the directory above where the HelloLiveView sample is installed, or to the directory above your workspace copy of the Hello LiveView sample.
-
In windows 2 and 3, navigate to the directory where the sample_adapter_embedded_lv-sbd is installed, or to your workspace copy sample.
-
In window 1, type:
lv-server run sample_lv-helloliveview
Wait until the console message "All tables have been loaded. LiveView is ready to accept client connections," appears before proceeding to the next step.
-
In window 2, type:
sbd -p 10001 -f sbd.sbconf lv2sbd.sbapp
This window will display the tuples dequeued from the downstream application.
-
In window 3, type:
sbc -p 10001 dequeue
The window shows the results from all the output streams. To see a single output stream, type:
sbc -p 10001 dequeue
StreamName
-
Open another StreamBase Command Prompt. In this fourth window, type the following command to terminate LiveView Server.
lv-client shutdown
-
In window 4, type the following command to terminate StreamBase Server.
sbadmin -p 10001 shutdown
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click
→ . -
In the search field, enter
Ready
to narrow the list of samples. -
Select the LiveView Adapters sample from the TIBCO Live Datamart 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 the permission problems that can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:
studio-workspace
/sample_lv-sbd
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/lv-sbd
See Default Installation Directories for the default location of studio-workspace
on your system.