WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

Introduction

This sample demonstrates how incoming events are stored in a H2 database using output RDBMS event adapter in two execution modes, which are insert and update-insert. This sample uses the default H2 database, which is shipped with WSO2 CEP.

The <DAS_HOME>/repository/conf/output-event-adapters.xml file includes configuration details of the supported RDBMSs.

Prerequisites

Follow the steps below to set up the prerequisites before starting the configurations.

  1. Set up the general prerequisites that are applicable to all WSO2 CEP Samples.
  2. Enable the following H2 database configurations by uncommenting them in the <DAS_HOME>/repository/conf/carbon.xml file as follows, to browse through the database and see the changes.

    Keep the other properties of the H2DatabaseConfiguration element uncommented.

    <H2DatabaseConfiguration>
    	<property name="web"/>
    	<property name="webPort">8082</property>
    	<property name="webAllowOthers"/>
    </H2DatabaseConfiguration>

Starting the server  

Start the WSO2 DAS server with the sample configuration numbered 0072. For instructions on starting WSO2 DAS server with a sample configuration, see Starting sample CEP configurations. This sample configuration points the default Axis2 repository to <DAS_HOME>/samples/cep/artifacts/0072/ directory. (By default, the Axis2 repository is pointed to <DAS_HOME>/repository/deployment/server/ directory).

Executing the sample

Follow the steps below to execute the sample.

  1. Log in to the management console.
  2. Click Tools, and then click Event Simulator.
  3. Click Play on the corresponding event stream as shown below, to send the events in the <DAS_HOME>/samples/cep/artifacts/0072/eventsimulatorfiles/events.csv file to the publisher.
  4. Use the following URL to access the H2 database through your web browser: https://localhost:8082

  5. Enter the following values to connect to the database. 

    ConfigurationDescription
    Driver ClassEnter the value as org.h2.Driver
    JDBC URLEnter the URL of the database. For example: jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000
    User Namewso2carbon
    Passwordwso2carbon
  6. Click Test Connection to check if the connection is successful.

  7. If the connection is successful, click Connect.

Output of the sample

After simulating events a new table (SENSORDATA) will be visible on the console as shown below.

The table corresponds to the following execution mode:

  • SENSORDATA - Contains records of insert execution mode. Mode does not consider primary keys and keeps on inserting values as per the events.

You can observe the results of the created table as shown below.

  • No labels