GoldenGate JMS Adatper: Integrate with OC4J JMS Queue

Prepare GoldenGate, Database, Extract Process

* See this post to setup GoldenGate and database.

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

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 JMS property file (ojms.properties).
* Set classpath.

 
gg.handlerlist=jms
 
gg.handler.jms.type=jms
gg.handler.jms.format=xml
 
# Oracle JMS property file
gg.handler.jms.properties=/dirprm/ojms.properties
 
# Setup classpath
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 JMS Property File (ojms.properties)

* Create in ‘dirprm’ directory.

#gg.jmshandler.persistent=false
#gg.jmshandler.durabletopic=false
 
gg.jmshandler.sessionmode=auto
 
# Use queue
gg.jmshandler.queueortopic=queue
gg.jmshandler.destination=jms/helloWorldQueue
gg.jmshandler.connectionfactory=jms/QueueConnectionFactory
 
# 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
# Or use opmn:ormi for automatic port determination
#java.naming.provider.url=opmn:ormi://localhost: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
# Or use opmn:ormi for automatic port determination
#java.naming.provider.url=opmn:ormi://localhost: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"?>
<!DOCTYPE application-client PUBLIC
      "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN"
      "http://java.sun.com/dtd/application-client_1_3.dtd">
<application-client>
    <display-name>Hello World App</display-name>
    <resource-ref>
        <res-ref-name>jms/QueueConnectionFactory</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>jms/helloWorldQueue</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"?>
<!DOCTYPE orion-application-client PUBLIC
"-//Evermind//DTD J2EE Application-client runtime 1.2//EN"
"http://xmlns.oracle.com/ias/dtds/orion-application-client.dtd">
<orion-application-client>
<resource-ref-mapping 
  name="jms/QueueConnectionFactory"
  location="jms/QueueConnectionFactory"/>
 
<resource-env-ref-mapping 
  name="jms/helloWorldQueue"
  location="jms/helloWorldQueue"/>
</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.