GridGain Developers Hub
GitHub logo GridGain iso GridGain.com
GridGain Software Documentation

GridGain Handler

GridGain Handler is an extension of GoldenGate UserExit. It starts a GridGain client node, receives different events, updates information received from a Extract or Replicat process, processes the information, performs cache operations if needed, and then returns response information to the Oracle GoldenGate.

Updates received from the Source Database are passed to the Data Source Operation Handler which should be implemented and set by the user. GridGain Handler works with any set of caches existing in a GridGain cluster. If the updates processing fails for any reason (e.g. network issues, etc.), GridGain Handler returns an error code, thus initiating failover in GoldenGate.

The Data Source Operation Handler provides an API to transform data from DataBase relation model to cache presentation. The API provides access to full GridGain API- cache API, data streaming, compute operations, etc (see Data Source Operation Handler) and allows you to use conflict resolution (see GoldenGate Conflicts Resolution).

GoldenGate Configuration

To use GoldenGate integration, Oracle GoldenGate should have two installed components:

  • A dynamically linked or shared library, implemented in C/C++, integrated as a userexit (UE) with the Oracle GoldenGate Extract process through a C API.

  • A set of Java libraries (jars), which contains the Oracle GoldenGate Java API. This Java framework communicates with the userexit through the Java Native Interface (JNI)

Required log level should be set for all the tables and schemas that will be replicated. Refer to the documentation of the database being used in your application (for Oracle Database, see https://docs.oracle.com).

GridGain Handler Configuration

To install GridGain Handler, you need to:

  1. Download and unpack GridGain archive from http://gridgain.com.

  2. Copy the integration/gridgain-goldengate folder to GOLDENGATE_ROOT_DIRECTORY

  3. Configure GoldenGate Extractor or Replicat with JavaUserExit. The GridGain Handler is associated with the Adapter Extract (see UserExit properties). For example, in the following schema, transactions are captured from the source database by a Primary Extract process that writes the data to an Oracle GoldenGate trail. A Data Pump Extract is then used to send the transactions to a trail that will be read by the Adapter Extract.

    # Extractor name.
    EXTRACT GRIDGAIN
    # Path to property file for `GridGain Handler`.
    SETENV ( GGS_USEREXIT_CONF = "dirprm/gridgain.props")
    # Credentials for database.
    USERID username, PASSWORD password
    CUSEREXIT libggjava_ue.so CUSEREXIT INCLUDEUPDATEBEFORES, PASSTHRU
    NOCOMPRESSUPDATES
    SOURCEDEFS dirdef/per.def
    TABLE *;
  4. Implement GridGain Handler and copy the jar with the handler to the GOLDENGATE_ROOT_DIRECTORY/gridgain-goldengate folder.

  5. Configure GridGain Handler via the property file. The property should have the path to GridGain XML configuration file. The Spring context should have the bean that has been implemented in the above step.

    # Handler name.
    gg.handlerlist=gridgain
    
    # Handler class name.
    gg.handler.gridgain.type=org.gridgain.oracle.goldengate.GridGainHandler
    # Path to GridGain configuration file. See XML tab.
    gg.handler.gridgain.configurationPath=dirprm/gridgain-configuration.xml
    # GoldenGate Handler bean name.
    gg.handler.gridgain.operationHandlerBeanName=personOpHandler
    
    # GoldenGate settings
    gg.report.time=30sec
    gg.classpath=gridgain-goldengate/*
    
    javawriter.stats.full=TRUE
    javawriter.stats.display=TRUE
    javawriter.bootoptions=-Xmx1024m -Xms1024m -Djava.class.path=ggjava/ggjava.jar:gg-lib/log4j.xml
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd">
        <bean id="personOpHandler" name="personOpHandler" class="org.gridgain.oracle.goldengate.handler.PersonOperationHandler"/>
    
        <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
            <property name="localHost" value="127.0.0.1"/>
    
            <property name="cacheConfiguration">
                <list>
                    <bean class="org.apache.ignite.configuration.CacheConfiguration">
                        <property name="name" value="person"/>
                        <property name="atomicityMode" value="ATOMIC"/>
                        <property name="backups" value="1"/>
                    </bean>
                    <bean class="org.apache.ignite.configuration.CacheConfiguration">
                        <property name="name" value="address"/>
                        <property name="atomicityMode" value="TRANSACTIONAL"/>
                        <property name="backups" value="1"/>
                    </bean>
                </list>
            </property>
        </bean>
    </beans>

GridGain Handler has the following properties:

Attribute Description Default value

type

Main class for GridGain Handler. This value must have the next value: org.gridgain.oracle.GridGainHandler

N/A

configurationPath

Path to GridGain XML configuration file. The configuration file should have a bean with the name set to operationHandlerBeanName property.

N/A

mode

Operation mode. Available values: op, tx, meta, all

op

operationHandlerBeanName

GoldenGate Handler bean name. This bean should be available in the XML configuration file and should implement DataSourceOperationHandler interface.

N/A