Contents
This topic takes you through the steps to create a new TIBCO Live Datamart project, create and configure a LiveView data table, generate an EventFlow application module that will feed the LiveView table, and create a feed simulation to send data into the EventFlow table. The steps go on to run the Live Datamart project, and view the results in TIBCO LiveView™ Desktop.
This tutorial's project has the following characteristics:
-
Has a single, three-column LiveView data table configured to contain stock symbol, price, and quantity values.
-
Has a wizard-generated TIBCO StreamBase EventFlow™ application that uses a feed simulation adapter to accept input from a StreamBase feed simulation, then emits that data to an output stream.
-
Uses the LiveView Configuration Editor to create all required LiveView tables and features.
Use the following steps to create a new project to contain the work of this tutorial:
-
Open StreamBase Studio.
-
In Studio's SB Authoring perspective, select → → . The New StreamBase Project dialog opens.
-
In the New StreamBase Project dialog, enter a name for the project. This example uses
my-first-liveview-project
. -
Clear the check box for Create empty EventFlow Application file.
-
Select the check box for Create a LiveView Data Table.
-
Keep the default selections for the check boxes Use default location, Maintain project settings, and the Java Build Path Options settings (with those check boxes selected).
-
Click
. This triggers several actions:-
A folder for the
my-first-liveview-project
appears in the Package Explorer view. -
The LiveView Project Viewer opens in the Editor space in Studio's upper right, showing an empty canvas.
-
On top of the empty Project Viewer, the New Data Table wizard opens, which is described in the next section.
-
On top of the wizard, the New StreamBase Project Created dialog appears; read the dialog and select the Do not show this again check box.
-
-
Continue to the next section
LiveView data tables are containers for streaming data. They can receive incoming streamed data from multiple sources, including EventFlow applications, external data sources, and other LiveView tables. This tutorial continues the New Project steps in the previous section to configure a LiveView data table with three fields.
-
The New Data Table wizard is still open from the last step in the previous section. (If not, open it with → → , or right-click the empty Project Viewer canvas and select New Data Table.)
-
Enter
Orders
in the Table Name field. -
In the Interface/Application field, define all fields locally is selected by default. In the Schema grid section, click the green plus sign to add the following fields to the grid:
Field Name Type Symbol string Price double Quantity int The Description column for each field is optional.
-
Click
to open the next page of the wizard. -
Make the
Symbol
field the primary key for this table in one of the following ways:-
In the Available Fields list, select
Symbol
, then click the right-pointing arrow next to the Index Fields label. -
In the Available Fields list, select
Symbol
then drag it to the Index Fields area with the mouse. -
Double-click
Symbol
.
-
-
Click
. This addsOrders.lvconf
to the project in the Package Explorer view, and places a green Data Table icon labeled Orders on the Project Viewer canvas. -
Use Ctrl+S on Windows and Linux, or Command+S on the Mac to save the current project state.
→ ,
The data table is now configured and ready to receive data.
The Live Datamart plug-ins for StreamBase Studio provide a Data Source wizard that can generate a StreamBase EventFlow module with output stream schemas preconfigured to match a particular LiveView data table's configuration. Follow these steps:
-
On the LiveView Project Viewer's canvas, right-click and select Data Source. The New LiveView Data Source wizard opens.
-
Select
my-first-liveview-project
as the parent folder. -
In the EventFlow™ Application file name field, change the default-entered
DataSource
toOrdersDataSource
. -
Leave the Create a sample feed simulation check box selected.
-
Use the drop-down menu selector in the Target Table field to select
Orders
. -
Click
. This triggers several actions:-
Three new files are added to the project in the Package Explorer view:
OrdersDataSource.sbapp
OrdersDataSource.sblayout
Orders.sbfs
-
A purple Data Source icon is added to the Project Viewer, with an arrow linking it to the Data Table icon.
-
The wizard creates two StreamBase interface files, places them in a new
lv-interfaces
subfolder, and automatically adds this subfolder to the project's resource search path.These interface files contain the schemas for the Orders data table's input and output streams. Using interface files allows the schemas to be used and reused efficiently throughout the project.
-
Studio opens the EventFlow Editor for the newly created module
OrdersDataSource.sbapp
.
-
-
In the EventFlow Editor:
-
Double-click the DataOut icon, select the General tab in Properties view, and make sure the check box for Always expose Stream for Dequeue is selected.
-
Study the Data Source application generated for you. Notice that it uses a Feed Simulation Input adapter to send generated tuples with the correct schema to its DataOut stream, which feeds into the Orders Data Table's input stream.
-
Double-click the InputAdapter icon, select the Adapter Properties tab of the Properties view, and notice that the generated file
Orders.sbfs
is preselected in the Feed Simulation File field. Notice that the feed simulation is configured to start automatically when the containing EventFlow module is started.This feed simulation file uses the Default generation method, in which random string and numeric values are generated as input data. After you have tested the generated Live Datamart application, you can come back and specify more precise customized data for each input field.
-
-
Use Ctrl+S on Windows and Linux, or Command+S on the Mac to save the current project state.
→ ,
This optional step is only to provide visual confirmation that the data source EventFlow module receives correctly formatted data from its connected feed simulation adapter.
-
Run the OrdersDataSource.sbapp application. Right-click in the editor canvas or on the
orders.sbapp
file in the Package Explorer view and select → . -
In the SB Test/Debug perspective, observe the Application Output view. Look for the outgoing data stream to be automatically populated by the associated feed simulation.
-
Click on a row in the application output tab and examine the tuple contents. Each tuple shows a generated value for Symbol, Price, and Quantity fields.
Notice that the DataOut stream also shows five LiveView-internal fields, usually with null values, in addition to the Symbol, Price, and Quantity fields you configured.
-
When done, press F9 or click the red Stop StreamBase Application button in Studio's top-level toolbar.
Now we are ready to compile and run the Live Datamart project on an instance of LiveView Server.
-
For clarity, close the EventFlow Editor session that is editing the
OrdersDataSource.sbapp
module. -
Run the LiveView project in one of several ways:
-
In the LiveView Project Viewer, click the green
button in the upper right, next to the Help button. -
Select the
my-first-liveview-project
project in the Package Explorer view. Right-click and select → . -
Select any of the lvconf files in the
my-first-liveview-project
project in the Package Explorer view. Right-click and select → . -
Select the
my-first-liveview-project
project in the Package Explorer view. From Studio's top-level menu, select → → .
-
-
The Console view shows several messages as Live Datamart Server compiles the project and starts. This startup process can take several minutes, depending on the configuration of your computer.
-
When you see the message
All tables have been loaded
in the Console view, you are ready to connect a client application to this server instance to view the stream of data flowing through this project's data table.
To see the data flowing through your running Live Datamart data table, you must connect a LiveView client to the server and use it to run a query using the LiveQL query language. The simplest query for this application is
select * from Orders;
or perhaps
select * from Orders limit 50;
The following LiveView Client applications are provided with Live Datamart or as related downloads:
-
lv-client, a command line utility, is included with Live Datamart.
-
The LiveView web monitor interface is built into Live Datamart server, and accessible from a web browser.
-
TIBCO LiveView™ Web is a web browser based client interface licensed and downloaded as a related product.
-
TIBCO LiveView™ Desktop is a Windows or Mac OS X desktop client application licensed and downloaded as a related product.
In addition, you can write LiveView clients of your own using the provided Java or JavaScript Client APIs.
The following subsections give brief instructions to connect each of these client types.
Follow these steps:
-
Open a StreamBase Command Prompt on Windows or a Terminal session on OS X. Make sure the Terminal session is configured with the sb-config --env command as described in Steps to Install StreamBase on macOS.
-
With the LiveView application running as described above, enter the following command at the prompt:
lv-client "select * from Orders limit 30;"
You may need to specify a LiveView URL to the running server:
lv-client -u lv://localhost:10080 "select * from Orders limit 30;"
Follow these steps:
-
With LiveView Server running, connect a web browser to:
http://localhost:10080/lv/monitor
-
Click the Run Queries link at the top right.
-
Double-click to select the Orders entry in the Table List. This places the default query in the query field:
select * from Orders
-
Click either the
or buttons. -
When done, click the
button.
To use the LiveView Web client, you must download and install it. Installing is usually a simple matter of the following steps:
-
If your LiveView project is running, stop it by clicking the read and blue button in Studio's top-level toolbar.
-
Create a new folder in your
my-first-liveview-project
folder. The new folder's name must belv-user-webapps
. -
Drag the
lvweb.war
file from the LiveView Web distribution into thelv-user-webapps
folder. -
Select the project folder in the Package Explorer view, right-click and select Refresh.
-
Restart LiveView Server on your project as described above.
With LiveView Web installed, use it to connect to your running server with the following steps:
-
With LiveView Server running, connect a web browser to:
http://localhost:10080/lvweb
-
Click New Page to create a new query page, perhaps named Orders Table.
-
Click New Card to create a query card.
-
In the dark blue section on the right, provide a title for your query card to replace the [Untitled] label, such as Orders Table -- All.
-
Still on the right, open the Query Builder section.
-
From the Choose a table control, select Orders.
-
The default query
select * from Orders
is entered for you in the Query field. -
Click Save Changes. This populates the Orders Table -- All card on the left.
-
Click the X in the upper right of the dark blue configuration area to close it.
-
Grab the bottom right corner of the Orders Table -- All card to resize it.
-
When done, close the browser tab. LiveView Web preserves your configured table in the project settings in Studio.
To use the LiveView Desktop client, you must download and install it. Once installed, run LiveView Desktop with the following steps:
-
Start LiveView Desktop with one of the following methods:
-
On Windows, invoke
→ → → → . -
On Mac OS X, use Spotlight or Launchpad to locate and invoke the app named
liveview.
-
On Linux, run the following command:
/opt/tibco/sb-cep/
n.m
/liveview/desktop/liveview &
Any of these methods opens the Connect to LiveView dialog.
-
-
In the dialog:
-
Type any username and no password.
-
In the Server field, enter
localhost
. -
Specify a Local workspace folder with any name.
-
Click
.
-
-
When LiveView Desktop connects to the server, the Orders table is opened in a data grid view on the right side, running with the default query
select * from Orders
. -
If you see only the Tables view by default, double-click the Orders table in the Tables View to get a look at the incoming data flowing through the table.
-
Experiment with different queries and different visualizations of the data.
-
When done, exit LiveView Desktop.
When done:
-
Close and exit your LiveView client connection.
-
Stop LiveView Server with Ctrl+F9 (Command+F9 on the Mac), or by clicking the red and blue button in StreamBase Studio's top-level toolbar.
You have now configured and run a simple LiveView project, and viewed its data with a LiveView client application.