Using Chronicle Data Sources

Note

Chronicle is not part of the base StreamBase kit, but is sold and installed separately. Please contact StreamBase for details. See Supported Configurations for the currently supported databases.

StreamBase Chronicle is an optional high-capacity event-store that can be used to provide persistent data storage in association with streaming applications. When using a Chronicle Connection component, a StreamBase application can query a Chronicle data source. The resulting data can then be processed by other components and merged with tuples from the application's input stream. This topic explains how to use an external Chronicle data source with your StreamBase application.

Note

Unlike other StreamBase Chronicle adapters, the Chronicle for Vhayu adapter does not use the Chronicle Connection data construct in the palette view in StreamBase Studio. The Vhayu adapter uses the Vhayu-native TCL scripting interface language instead. See the documentation that accompanies your Chronicle for Vhayu kit for instructions.

A Chronicle database might be installed on one or more machines, separately from the StreamBase installation. After installing and configuring the Chronicle database you want to use, you can identify it as a data source in your StreamBase application's sbd.sbconf file.

In a StreamBase EventFlow, you add a Chronicle Connection data construct that points to the Chronicle data source, and then connect the data construct to one or more Query operators, where you can perform query operations against the data source.

The following figure depicts the components in a simple EventFlow application connected to a Chronicle Database:

Note

If StreamBase Chronicle is not installed, the Chronicle Connection component is visible in the Palette, but cannot be added to your application.

In StreamSQL applications, the APPLY CHRONICLE statement references the name of a Chronicle data source, and contains a SELECT clause that performs the query. In both types of applications, the query must be in the format recognized by the Chronicle database you are using, not StreamSQL statements. Here is a simple example within a StreamSQL application:

CREATE INPUT STREAM in (symbol string(4));
CREATE OUTPUT STREAM out;

APPLY CHRONICLE myChronicleDB "SELECT sum(column_name_1) 
  FROM chronicleDB_table WHERE column_name_2={symbol}" FROM in INTO out;

Note

In both StreamSQL and EventFlow applications, you will query the Chronicle database using embedded query statements in a format supported by the database you are using. In the preceding StreamSQL example, the embedded statement is shown between double quotes.

Before You Begin

While you are authoring an application that uses a Chronicle database, StreamBase Studio must be connected to the database in order to perform typechecking. In preparation for connecting to the database, gather the following information from your Chronicle database administrator:

  • The URI to connect to the Chronicle Database server (data source).

  • If required, a username and password to use when connecting to the database server.

Developing an Application with a Chronicle Database

This section describes the main steps to design an application using a Chronicle database. The procedure includes links to other topics where more detailed tasks are described. In StreamBase Studio:

  1. If the configuration file, sbd.sbconf, does not exist in the root folder of your project, create it (as described in Creating a New Server Configuration File).

  2. Open the project's sbd.sbconf file.

  3. Declare the Chronicle data source in the data-sources section of the sbd.sbconf file, based on the information you gathered from the Chronicle administrator in the preceding section. For example:

        <data-sources>
            <data-source name="bigDB" type="chronicle">
              <uri value="jdbc:chronicle://192.168.42.128:5433/chronicledb" />
              <param name="user" value="devel" />
            </data-source>
        </data-sources>
    

    StreamBase Server Configuration XML describes the sbd.sbconf in detail.

  4. Connect to the Chronicle Database and access its data.

    • If you are editing a StreamSQL application, follow the guidelines in APPLY Statement, in the StreamSQL Guide.

      StreamSQL uses the APPLY CHRONICLE statement to point to the Chronicle database you want to use. In that statement, you can select data from the database tables, along with data from an input stream specified by the FROM clause.

    • If you are editing an EventFlow application:

      1. Drag a Chronicle Connection icon from the Palette view to your canvas, creating a new data construct.

      2. Open the Properties view of your Chronicle Connection. Name the component and identify the data source it will use, as described in Using the Chronicle Connection Data Construct.

      3. Create the Query operator or operators that will be associated with the Chronicle Connection: for each one, drag a Query Table icon from the Palette view to your application diagram.

      4. Connect the Query operator or operators to the Chronicle Connection. At this time, StreamBase Studio will perform typechecking. If a typecheck error reports an "unknown data-source", make sure that the Chronicle Database is running correctly and configured in the sb.sbconfig configuration file.

      5. For each Query operator, edit its properties as described in Using the Query Operator.

The output of your StreamSQL APPLY statement or EventFlow Query Operator can be used in another component for further processing.

Configuring an Application for Deployment With a Chronicle Database

When you complete your application and are ready to deploy it outside of StreamBase Studio, you can export all the files you have developed in StreamBase Studio to your deployment environment, using the Eclipse Export wizard. The sbd.sbconf file that you use in your runtime environment must then be configured to access the Chronicle data sources there, as follows (refer to StreamBase Server Configuration XML for full details):

Note

During development, you could enable StreamBase Studio to resolve the locations of resources in various ways. For example, the resources in your exported sbd.sbconf may be specified as just file names with no directory paths. By contrast, for deployment (that is, outside of StreamBase Studio) you must explicitly include the path information for all resources in your configuration file.