shyiko / rook

Change Data Capture (CDC) toolkit for keeping system layers in sync with the database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rook Build Status Coverage Status

Change Data Capture (CDC) toolkit for keeping system layers in sync with the database.

Out-of-box rook includes support for MySQL as a source and Hibernate 4 cache (2nd Level & Query), FullText index backed by Hibernate Search as targets.

Usage

The latest release version available through Maven Central.

Eviction of Hibernate 4 Second Level/Query cache records in response to the replication events (on MySQL)

<dependencies>
    <dependency>
        <groupId>com.github.shyiko.rook</groupId>
        <artifactId>rook-source-mysql</artifactId>
        <version>0.1.3</version>
    </dependency>
    <dependency>
        <groupId>com.github.shyiko.rook</groupId>
        <artifactId>rook-target-hibernate4-cache</artifactId>
        <version>0.1.3</version>
    </dependency>
</dependencies>
org.hibernate.cfg.Configuration configuration = ...
org.hibernate.SessionFactory sessionFactory = ...
new MySQLReplicationStream("hostname", 3306, "username", "password").
    registerListener(new HibernateCacheSynchronizer(configuration, sessionFactory)).
    connect();

Integration tests available at supplement/integration-testing/hibernate4-cache-over-mysql

Update of Hibernate 4 Search controlled FT index in response to the replication events (on MySQL)

Keep in mind that default indexer, which is used by FullTextIndexSynchronizer, relies on @org.hibernate.search.annotations.ContainedIn for propagation of indexing events to the container entity(ies). As a result, either each @IndexedEmbedded-annotated field/method MUST have corresponding @ContainedIn member (inside target entity) or a different indexer is required.

<dependencies>
    <dependency>
        <groupId>com.github.shyiko.rook</groupId>
        <artifactId>rook-source-mysql</artifactId>
        <version>0.1.3</version>
    </dependency>
    <dependency>
        <groupId>com.github.shyiko.rook</groupId>
        <artifactId>rook-target-hibernate4-fulltextindex</artifactId>
        <version>0.1.3</version>
    </dependency>
</dependencies>
org.hibernate.cfg.Configuration configuration = ...
org.hibernate.SessionFactory sessionFactory = ...
new MySQLReplicationStream("hostname", 3306, "username", "password").
    registerListener(new FullTextIndexSynchronizer(configuration, sessionFactory)).
    connect();

Integration tests available at supplement/integration-testing/hibernate4-fulltextindex-over-mysql

License

Apache License, Version 2.0

About

Change Data Capture (CDC) toolkit for keeping system layers in sync with the database


Languages

Language:Java 94.2%Language:Shell 3.6%Language:Batchfile 2.2%