This topic describes how to run the TIBCO ActiveSpaces® operator sample application, which illustrates how to use the operators with an ActivesSpaces DataGrid. For more information on this operator, see Using the TIBCO ActiveSpaces Operators.
This sample includes a number of ActiveSpaces operators, which by default connect to an ActiveSpaces data grid named
TestGrid on localhost. The sample data grid supplied with the ActiveSpaces installation is assumed to be running on localhost already,
%TIBDG_ROOT%/samples/scripts/as-start.bat on Windows systems or the corresponding script on other platforms.
Once connected, you can use the sample to put rows into and retrieve rows from the sample table (named
t1) using the various ActiveSpaces operators.
In StreamBase Studio, import this sample with the following steps:
From the top-level menu, select→ .
activeto narrow the list of options.
Select TIBCO ActiveSpaces Operators from the category.
StreamBase Studio creates a single project for the ActiveSpaces Operator samples in your current Studio workspace.
This sample contains the following files:
The sample EventFlow application,
sbd.sbconf, which StreamBase Server uses to configure the Java environment to locate the ActiveSpaces libraries and define the ActiveSpaces data grid to which to connect.
Use the following steps to run this sample:
Before running, you must configure the project to locate and load the ActiveSpaces libraries. In the Package Explorer, right-click on the top-level node of your project and select → . On the Libraries tab of the dialog box that appears, if there is no entry for
tibdg.jarin the list, click the button. This brings up a file browser; navigate to your ActiveSpaces installation lib directory, select
tibdg.jarand click . Back in the Libraries tab, an entry is now added for
Make sure the data grid that ships as an ActiveSpaces sample is up and running on the local machine (or, if running it on another machine, edit
sbd.sbconfto point the data grid definition to the right IP address). You can launch the data grid by running
In the Package Explorer, double-click to open the
Make sure the application is the currently active tab in the EventFlow editor, then click the Run button. This opens the SB Test/Debug perspective and starts the application.
Once the application has started, the ActiveSpaces Control operator connects to the data grid then sends a
Connectedtuple to the application.
In the Manual Input view, select the
Enter the following values:
Clickand observe that the
PutResultsoutput stream received a tuple with its
inputfield set to the given command tuple and its
rowfield set to null, indicating that the operation succeeded and finished.
Still in the Manual Input view, select the
GetCmdstream and enter
1as the value for the key field, then click . This fetches the row with key
1and emit it on the GetResults output stream, followed by a marker tuple (row = null) to indicate the operation finished executing.
You may similarly send arbitrary queries to a table (for example,
SELECT * FROM t1 WHERE key > 0) using the QueryCmd stream and remove rows using the DeleteCmd stream. Of note is the ControlCmd stream which allows you to send control commands to, for example, disconnect from the data grid. Finally, if you have defined your data grid connection to be transacted (by adding
<setting name="transacted-session" val="true"/>to the definition) you can commit or rollback your data grid operations using the
When done, press F9 or click the Stop Running Application 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.
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:
See Default Installation Directories for the location of
studio-workspace on your system.