TIBCO LogLogic Unity Query Adapter Samples

This topic describes how to run the TIBCO LogLogic Unity Query Adapter sample applications, which illustrate how to use the operator with a TIBCO LogLogic Unity server. For more information on this adapter, see TIBCO LogLogic Unity Query Input Adapter.

Samples Setup in StreamBase Studio

You must configure the sbd.sbconf file before running either of the following sample applications. The options in the sbd.sbconf file configure the sample applications to connect to your LogLogic Unity server. Do the following:

  • Open the sbd.sbconf file.

  • Edit the operator-parameter value fields for your LogLogic Unity server.

Before running either sample, do the following:

  • Open the sbapp specified by the sample.

  • Locate the Query operator and open its StreamBase Properties page and select the Edit Schema tab.

  • Click the Generate schema from query hyperlink and enter the query you intend to run into the dialog that appears and click OK. This generates the schema required for the query.

  • Click the Query operator.

Cached Query Full Results Sample

Sample Overview

This sample demonstrates how to run a cached query on the server and poll for the results until complete using event flow.

Running the Sample in StreamBase Studio

Run this sample in Studio as follows:

  1. In the Project Explorer, double-click to open the CachedQueryFullResults.sbapp application.

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

  3. In the Manual Input view, select the QueryIn input stream.

    Enter an EQL or SQL query string.

  4. Click Send Data. This triggers the adapter to connect to the Unity server and start the query.

    The event flow is set up to watch the QueryStatus for a Query Start status message containing the query ID as the object, then in turn start a getresults command to pull the query results.

    The QueryResults display the results and feed back into the adapter a new query to get the next set of results if required.

    When the query is complete a delete query command is sent to remove the query from the server.

  5. In the Application Output view look over the results of the QueryResults and QueryStatus streams.

  6. When done, press F9 or click the Stop Running Application button.

LogLogic Unity Sample

Sample Overview

This sample contains an input stream for the various command types that the adapter can perform. The QueryIn stream can be used for any command and holds all possible input parameters for any parameter. Parameters that are not used for a particular command are ignored.

Running the Sample in StreamBase Studio

Run this sample in Studio as follows:

  1. In the Project Explorer, double-click to open the LogLogicUnity.sbapp application.

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

  3. In the Manual Input view, select the CachedQueryIn stream to start a query. Enter a value in the query field. Optionally you can set the pollUntilComplete to true if you want all results to be processed and output. If the value is false you must manually trigger a getresults command by using the GetResultsIn input stream.

  4. Click Send Data. This triggers the adapter to send data to the Unity server.

  5. In the Application Output view, find the Status message which will have an action of Query Started. The object field of the status contains the queryId.

  6. In the Manual Input view, select the GetResultsIn input stream. Enter the query ID from the status port mentioned above. The resultSetId field can be null and defaults to 0 (the first result).

  7. Click Send Data, which tells the adapter to get the first result set for the query.

  8. In the Application Output view, find the QueryResults message, which contains the query results.

  9. In the Manual Input view, select the DeleteQueryIn stream. Enter the query ID from the status port mentioned above.

    Click Send Data, which tells the adapter to delete the query from the server.

  10. Click Send Data, which tells the adapter to delete the query from the server.

  11. When done, press F9 or click the Stop Running Application button.

Importing This Sample into StreamBase Studio

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

  • From the top-level menu, select FileLoad StreamBase Sample.

  • Type active to narrow the list of options.

  • Select TIBCO LogLogic Unity Query from the Extending StreamBase category.

  • Click OK.

StreamBase Studio creates a single project for the LogLogic Unity Query sample in your current Studio workspace.

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_adapter_embedded_tibco-loglogic-unity

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

In the default TIBCO StreamBase installation, this sample's files are initially installed in:

streambase-install-dir/sample/adapter/embedded/tibco-loglogic-unity

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