WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
Skip to end of metadata
Go to start of metadata


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 <CEP_HOME>/repository/conf/output-event-adapters.xml file includes configuration details of the supported RDBMSs.


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

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

Starting the server  

Start the WSO2 CEP server with the sample configuration numbered 0072. For instructions on starting WSO2 CEP server with a sample configuration, see Starting sample CEP configurations. This sample configuration points the default Axis2 repository to <CEP_HOME>/samples/cep/artifacts/0072/ directory. (By default, the Axis2 repository is pointed to <CEP_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 <CEP_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. 

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