Contents
This sample demonstrates the capability of the Query operator to read and write data in QueryTables across container boundaries. This sample contains three EventFlow modules: TableHome, Reader, and Writer. TableHome is the main module and contains the QueryTable that the other modules will access.
Reader and Writer each contain a QueryTable data construct that defines its table as Defined
by connection path
, with the connection path as default.LocalTable
.
Here, default
is the container name (corresponding to
TableHome.sbapp
), and LocalTable
is the name of the
concrete QueryTable in that container.
See the Query operator sample for an introduction to Query operators. This sample deals with the advanced concept of cross-container connections. Read about Containers in the StreamBase Container Overview article.
In StreamBase Studio, import this sample with the following steps:
-
From the top-level menu, click
> . -
Enter
container
to narrow the list of options. -
Select Create a shared Query Table across containers from the Data Constructs and Operators category.
-
Click
.
StreamBase Studio creates a single project for the sample.
To start this sample:
-
In the Project Explorer view, open the sample you just loaded.
-
Open the
src/main/eventflow/
folder.packageName
-
Open the
TableHome.sbapp
file and click theRun button. This opens the SB Test/Debug perspective and starts the module.
-
In the Output Streams view, select
All Output Streams
in the Stream drop-down control. The view initially shows the results of automatically loading the modules' feed simulations. -
In the Manual Input view, select
reader.FSControl
in the Stream drop-down control. -
Enter
start
in the command field, andnull
in the value field. -
Click
. In the Output Streams view, observe the sku, category, location, and other data. This data has been successfully read from the cross-container table.You can also send input manually. To do this, first stop the feed simulation by sending
stop
andnull
in the command and value fields, respectively. Then, select thereader.ManualFeed
from the Stream drop-down. Enter anything for sku, for example, ABCD, and see what is is found.Data for the table was initially populated by the
Writer
module via its feed simulation. This is why results are available immediately. In normal operation, data would need to be written first, such as via manual input. -
When done, press F9 or click the
Terminate EventFlow Fragment button.
The Cross Container Table sample includes the following files:
- TableHome.sbapp
-
Default module containing the concrete QueryTable
- Reader.sbapp
-
Reads data from TableHome
- Writer.sbapp
-
Writes initial data to TableHome when the fragment is launched
- engine.conf
-
Associates container names with their respective EventFlow modules
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_cross-container-table
See Default Installation Directories for the default location of studio-workspace
on your system.