Scenario Description
In this scenario we are sending a XML message to the queue and using Goldengate the message is read from the queue and updated in the table.
Creating a message in JMS
Setup for Java adapter
Install Java jdk1.5 or later
Set env variables
Windows:
set JAVA_HOME=C:\prog\java\jdk1.6.0_18
set PATH=%JAVA_HOME%\bin;%PATH%
set PATH=%JAVA_HOME%\jre\bin\server;%PATH%
Download Java Adapter for GG and unzip it to GG home directory
Setup for ActiveMQ
Download ActiveMQ from http://activemq.apache.org/download.html
Unzip zip download onto a local directory
Set JAVA_HOME (e.g. set JAVA_HOME=C:\prog\java\jdk1.5.0_08)
Start ActiveMQ by running 'bin\activemq.bat'
Open ActiveMQ admin page at http://localhost:8161/admin/index.jsp
userid source, password source
defsfile dirdef/source.def
table source.t_source;
Creating a message in JMS
1) Active MQ(JMS).Enter a queue name and click create.
2)Once the queue is created then click on “send to” to send message to queue
3)Copy the XML message to the “Message body” and click on send.
4)Now you can view your message in pending messages
Extract group parameter file e_jms.prm
Extract e_jms
TRANLOGOPTIONS VAMCOMPATIBILITY 1
TRANLOGOPTIONS GETMETADATAFROMVAM
VAM ggjava_vam.dll, PARAMS (./dirprm/vam.properties)
ReportCount Every 1000 Records, Rate
GETUPDATEBEFORES
ExtTrail ./dirdat/tz
table source.t_source;
GGSCI >add extract e_jms, VAM
GGSCI >add extTrail ./dirdat/tz, extract e_jms, megabytes 100
Replicat group parameter file r_jms
replicat r_jms
userid source, password source
assumetargetdefs
exttrail dirdat/tz
map source.t_source, target source.t_source;
GGSCI >add replicat r_jms, exttrail dirdat/tz, checkpointtable target.ckpt
VAM.PROPERTIES
log.level=INFO
log.logname=e_jms
log.tostdout=true
log.tofile=true
provider.type=jms
gg.source=jms
gg.report.time=30sec
jvm.bootoptions=-Xmx64m -Xms64m -Djava.class.path=.;./dirprm;./ggjava/ggjava.jar;./dirtmp/activemq-all-5.4.0.jar -Dlog4j.configuration=log4j.properties
java.naming.provider.url=tcp://w2fzdmd901:61616
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
gg.jms.destination=dynamicQueues/sample
gg.jms.connectionFactory=ConnectionFactory
gg.jms.id=time
xml.sourcedefs=.\dirdef\source.def
xml.rules=dyntxrule
dyntxrule.type=tx
dyntxrule.match=/tx
dyntxrule.subrules=dynoprule
dyntxrule.txid=*txid
dynoprule.type=op
dynoprule.seqid=*seqid
dynoprule.timestamp=@ts
dynoprule.match=./op
dynoprule.schemaandtable=@table
dynoprule.optype=@type
dynoprule.subrules=dyncolrule
dyncolrule.type=col
dyncolrule.match=./col
dyncolrule.name=@name
dyncolrule.index=@index
dyncolrule.before.value=./before/text()
dyncolrule.after.value=./after/text()
parser.type=xml
xml data to queue
<?xml version="1.0"?>
<tx>
<op table='SOURCE.T_SOURCE' type='I' ts='2011-04-06:16:00:13.000000' pos='00000000050000002541'>
<col name='ID' index='0'>
<before missing='true'/>
<after>4</after>
</col>
<col name='NAME' index='1'>
<before missing='true'/>
<after>TEST</after>
</col>
</op>
</tx>
No comments:
Post a Comment