Skip to content

mohanvive/siddhi-io-cdc

 
 

Repository files navigation

Siddhi IO CDC

Jenkins Build Status GitHub Release GitHub Release Date GitHub Open Issues GitHub Last Commit License

The siddhi-io-cdc extension is an extension to Siddhi that captures change data from databases such as MySQL, MS SQL, PostgreSQL, H2 and Oracle.

For information on Siddhi and it's features refer Siddhi Documentation.

Download

  • Versions 3.x and above with group id io.siddhi.extension.* from here.
  • Versions 2.x and lower with group id org.wso2.extension.siddhi.* from here.

Latest API Docs

Latest API Docs is 2.0.3.

Features

  • cdc (Source)

    The CDC source receives events when change events (i.e., INSERT, UPDATE, DELETE) are triggered for a database table. Events are received in the 'key-value' format.

    There are two modes you could perform CDC: Listening mode and Polling mode.

    In polling mode, the datasource is periodically polled for capturing the changes. The polling period can be configured.
    In polling mode, you can only capture INSERT and UPDATE changes.

    On listening mode, the Source will keep listening to the Change Log of the database and notify in case a change has taken place. Here, you are immediately notified about the change, compared to polling mode.

    The key values of the map of a CDC change event are as follows.

    For 'listening' mode:
        For insert: Keys are specified as columns of the table.
        For delete: Keys are followed by the specified table columns. This is achieved via 'before_'. e.g., specifying 'before_X' results in the key being added before the column named 'X'.
        For update: Keys are followed followed by the specified table columns. This is achieved via 'before_'. e.g., specifying 'before_X' results in the key being added before the column named 'X'.

    For 'polling' mode: Keys are specified as the columns of the table.

    See parameter: mode for supported databases and change events.

Dependencies

JDBC connector jar should be added to the runtime. Download the JDBC connector jar based on the database type that is being used.

For MySQL, use connector version 5.1.xx.

In addition to that, there are some prerequisites that need to be met based on the CDC mode used. Please find them below.

Default mode (Listening mode):

Currently MySQL, PostgreSQL and SQLServer are supported in Listening Mode. To capture the change events, databases have to be configured as shown below.

Polling mode:

  • Change data capturing table should be have a polling column. Auto Incremental column or Timestamp can be used.

Please see API docs for more details about change data capturing modes.

Installation

For installing this extension on various siddhi execution environments refer Siddhi documentation section on adding extensions.

Running Integration tests in docker containers(Optional)

The CDC functionality are tested with the docker base integration test framework. The test framework initialize a docker container with required configuration before execute the test suit.

Start integration tests

  1. Install and run docker

  2. To run the integration tests, navigate to the siddhi-io-cdc/ directory and issue the following commands.

    • H2 default:

        mvn clean install
      
    • MySQL 5.7:

         mvn verify -P local-mysql -Dskip.surefire.test=true
      
    • Postgres 9.6:

         mvn verify -P local-postgres -Dskip.surefire.test=true
      
    • MSSQL:

         mvn verify -P local-mssql -Dskip.surefire.test=true
      
    • Oracle 11.2.0.2-xe:

         mvn verify -P local-oracle -Dskip.surefire.test=true
      

Support and Contribution

  • We encourage users to ask questions and get support via StackOverflow, make sure to add the siddhi tag to the issue for better response.

  • If you find any issues related to the extension please report them on the issue tracker.

  • For production support and other contribution related information refer Siddhi Community documentation.

About

Extension which consumes CDC events

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%