GoldenGate JMS Adapter: Oracle AQ Integration

Prepare GoldenGate, Database, Extract Process

* See this post to setup GoldenGate and database.

Install Java Adapter

* See this post to setup GoldenGate Java Adapter.

Prepare OC4J AQ

* See this post to setup OC4J AQ environment.

Add User Exit Data Pump (u_gt)

* Create a new data pump extract process and point to trail files.

ADD EXTRACT u_gt, EXTTRAILSOURCE ./dirdat/gt

Edit Data Pump Parameter File

edit params u_gt

Extract u_gt
 
# Point to property files
SetEnv ( GGS_USEREXIT_CONF = "dirprm/cuserexit.properties" )
SetEnv ( GGS_JAVAUSEREXIT_CONF = "dirprm/javaue.properties" )
 
SourceDefs ./dirdef/gg_test.def
 
# User exit process command
CUserExit ./JavaUserExit.dll CUSEREXIT PASSTHRU INCLUDEUPDATEBEFORES
 
Table gg_src.*;

cuserexit.properties (Same as ActiveMQ)

* Copy ‘cuserexit.properties’ from ‘javaue\docs\sample-dirprm’ directory to ‘dirprm’ directory.
* Edit ‘cuserexit.properties’

goldengate.userexit.chkptprefix=JAVAUE_
goldengate.userexit.nochkpt=TRUE
goldengate.userexit.timestamp=utc
 
# Setup logging
goldengate.log.modules=GENUSEREXIT,LOGMALLOC,JAVAWRITER
#goldengate.log.level=INFO
goldengate.log.level=DEBUG
goldengate.log.level.LOGMALLOC=ERROR
goldengate.log.tostdout=false
goldengate.log.tofile=true
goldengate.log.logname=cuserexit
 
# Setup javawriter
goldengate.userexit.writers=javawriter
javawriter.stats.time=600
javawriter.stats.numrecs=100
javawriter.stats.display=TRUE
javawriter.stats.full=TRUE
javawriter.bootoptions=-Djava.class.path=javaue/ggue.jar -Dlog4j.configuration=log4j.properties -Xmx512m -Xms256m

javaue.properties

* Create in dirprm directory.
* Use jms handler.
* Point to Oracle AQ property file (oaq.properties).
* Set classpath.

gg.handlerlist=jms
 
gg.handler.jms.type=jms
gg.handler.jms.format=xml
 
# Oracle AQ
gg.handler.jms.properties=/dirprm/oaq.properties
gg.classpath=.,C:/prog/oracle/product/10.1.3.1/OracleAS_1/lib/dms.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/jdbc/lib/ojdbc14.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/jazn.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/oc4j.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/oc4jclient.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/lib/adminclient.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/lib/bcel.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/lib/connector.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/lib/javax77.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/lib/jms.jar,C:/prog/oracle/product/10.1.3.1/OracleAS_1/j2ee/home/lib/oc4j-internal.jar
 
# (commented out) set to "true" to turn OFF sending jms messages
# gg.handlerlist.nop=true

Oracle AQ property file (oaq.properties)

* Create in dirprm directory.

gg.jmshandler.sessionmode=auto
 
# Use queue destination
gg.jmshandler.queueortopic=queue
gg.jmshandler.destination=MyAQJMSCtx/MyQ
gg.jmshandler.connectionfactory=MyAQJMSCtx/MyQCF
 
# java.naming properties should be placed in jndi.properties file
#java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory
#java.naming.provider.url=ormi://localhost:12401/MyAQJMSResourceAdatper
# Or use opmn:ormi for automatic port determination
#java.naming.provider.url=opmn:ormi://localhost/MyAQJMSResourceAdatper:home
 
#java.naming.security.principal=oc4jadmin
#java.naming.security.credentials=welcome1

jndi.properties

* Create in GoldenGate install root directory.

java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory
java.naming.provider.url=ormi://localhost:12401/MyAQJMSResourceAdatper
# Or use opmn:ormi for automatic port determination
#java.naming.provider.url=opmn:ormi://localhost/MyAQJMSResourceAdatper:home
java.naming.security.principal=oc4jadmin
java.naming.security.credentials=welcome1

Prepare META-INF Files

* Contents of both application-client.xml and orion-application-client.xml seem can be dummied. Without them, GoldenGate will complain but Java Adapter will allow the process to continue.
* Create ‘META-INF’ directory under GoldenGate install.
* Create ‘application-client.xml’ in META-INF directory.

<?xml version = '1.0' encoding = 'windows-1252'?>
<application-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <display-name>MyAQJMSClient-app-client</display-name>
    <resource-ref>
        <res-ref-name>MyAQJMSCtx/MyQCF</res-ref-name>
        <res-type>javax.jms.QueueConnectionFactory</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-env-ref>
        <resource-env-ref-name>MyAQJMSCtx/MyQ</resource-env-ref-name>
        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
    </resource-env-ref>
</application-client>

* Create an empty ‘orion-application-client.xml’ in META-INF directory.

<?xml version = '1.0' encoding = 'windows-1252'?>
<orion-application-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-client-10_0.xsd">
    <resource-ref-mapping 
      name="MyAQJMSCtx/MyQCF"
      location="MyAQJMSCtx/MyQCF"/>
 
    <resource-env-ref-mapping 
      name="MyAQJMSCtx/MyQ"
      location="MyAQJMSCtx/MyQ"/>
</orion-application-client>

Start Processes

C:\>set JAVA_HOME=C:\prog\java\jdk1.6.0_18
C:\>set PATH=%JAVA_HOME%\bin;%PATH%
C:\>set PATH=%JAVA_HOME%\jre\bin\server;%PATH%
C:\>ggsci
 
GGSCI>start mgr
GGSCI>start extract e_gt
GGSCI>start extract u_gt

References

GoldenGate: Java Adatper

This entry was posted in goldengate. Bookmark the permalink.