Cross Container Table

About This Sample

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.

Importing This Sample into StreamBase Studio

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

  • From the top-level menu, click File>Import Samples and Community Content.

  • Enter container to narrow the list of options.

  • Select Create a shared Query Table across containers from the Data Constructs and Operators category.

  • Click Import Now.

StreamBase Studio creates a single project for the sample.

Running This Sample in StreamBase Studio

To start this sample:

  1. In the Project Explorer view, open the sample you just loaded.

  2. Open the src/main/eventflow/packageName folder.

  3. Open the TableHome.sbapp file and click the Run button. This opens the SB Test/Debug perspective and starts the module.

  4. 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.

  5. In the Manual Input view, select reader.FSControl in the Stream drop-down control.

  6. Enter start in the command field, and null in the value field.

  7. Click Send Data. 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 and null in the command and value fields, respectively. Then, select the reader.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.

  8. When done, press F9 or click the Terminate EventFlow Fragment button.

This Sample's Files

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

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_cross-container-table

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