Contents
This sample provides Java code that illustrates the StreamBaseClient.readTable()method, which is used to display all or a specified number of rows from a Query Table. The Java code is provided in the ReadTableClient.java program in the java-src folder.
                  
The sample contains an EventFlow application, ReadTable.sbapp that contains the following elements:
                  
- 
                           
A local Query Table named
SimpleTable. - 
                           
A module reference to
ReadTableModule.sbapp, which contains a shared table namedSharedTable. - 
                           
A module reference to
ReadTableModuleWithPlaceholder.sbapp, which contains a placeholder table namedPlaceholderTablethat is mapped toConcreteTable. 
The sample demonstrates the ability to retrieve rows from any of these tables, using the following paths at runtime:
[containername.]SimpleTable
                         | 
                     
[containername.]ReadTableModuleRef.SharedTable
                         | 
                     
[containername.]ReadTableModuleWithPlaceholderRef.PlaceholderTable
                         | 
                     
[containername.]ConcreteTable
                         | 
                     
where containername is optional if you run ReadTable.sbapp in the default container named default, but must be present for non-default container names.
                  
You run this sample in two steps:
- 
                           
Run the
ReadTable.sbappapplication.On startup, a CSV File Reader adapter populates all tables with the same contents, which are read from the file
InitialData.txt. (You can supplement this populated data by sending tuples to theInsertToAllTablesinput stream.) The application then awaits further input or a client connection. - 
                           
Run the
ReadTableClient.javaprogram as a Java application. This StreamBase client program connects to theReadTable.sbappapplication, reads values from its various table constructs, and prints Its output to the console. 
In StreamBase Studio, import this sample with the following steps:
- 
                           
From the top-level menu, click >.
 - 
                           
Enter
readtto narrow the list of options. - 
                           
Select the ReadTable sample from the Client Libraries category.
 - 
                           
Click .
 
StreamBase Studio creates a project for this sample.
Follow these steps:
- 
                           
In the Project Explorer view, open the sample you just loaded.
If you see red marks on a project folder, wait a moment for the project to load its features.
If the red marks do not resolve themselves after a minute, select the project, right-click, and select > from the context menu.
 - 
                           
Open the
src/main/eventflow/folder.packageName - 
                           
Open the
ReadTable.sbappfile and click the
  button. This opens the SB Test/Debug perspective and starts the module.
                           Notice in the Output Streams view the set of key-value pairs that was used to populate the tables.
 - 
                           
Return to the SB Authoring perspective.
 - 
                           
In the Project Explorer view, open the
java-srcfolder tree to expose theReadTableClient.javafile. - 
                           
Right-click the
ReadTableClient.javafile and from the context menu, select >. - 
                           
Observe the results of the Java program in the Console view.
 - 
                           
When done, press F9 or click the
 Terminate EventFlow Fragment button.
                            
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_ReadTableSee Default Installation Directories for the default location of studio-workspace on your system.
                  
