In this section: |
iWay Informix CDC Agent listens and reads the Informix Logical Log for INSERT, UPDATE, DELETE records using the Informix Change Data Capture (CDC) API.
The iway_runcdc.sh startup script is used to execute the iWay Informix CDC Agent application. The following command structure must be used to execute the iway_runcdc.sh script:
iway_runcdc.sh -E <cdc_env_file> -S <subscr_name> -L <LSN param>
where:
Is the full path to the iWay CDC environment file (iwaycdc.env).
Is the predefined subscription name.
Can be either 0 (zero), if you are starting new CDC session, a Last Sequence Number (LSN) using the <log id>:0x<position> format, or the keyword resume, which automatically retrieves the LSN from the subscription control file.
For example:
iway_runcdc.sh -E /home/iwayqa/cdcagent/config/iwaycdc.env –S subscr001 –L 0
You can check if the Informix CDC is running by grepping for the process:
$ ps -ef | grep iwaycdc
The the iWay CDC environment file (iwaycdc.env) is passed to the iway_runcdc.sh startup script as a parameter. By executing this environment file, the iWay Informix CDC Agent application sets the general global environment variables for the iWay Informix CDC instance.
The CDC_HOMEDIR variable must be set in the iwaycdc.env file. All remaining variables have default values, but are also configurable:
File names and extensions include .env, .txt, .ctr, .trc, .lsn, and .seq.
The InformixLEAShutdown.sh script is used to shut down the iWay Informix CDC Agent and all of its processes. The InformixLEAShutdown.sh script calls a C binary program, which can either stop the logging process and completely shut down the agent or just stop the agent.
Based on your requirements, the following methods are available to shut down the iWay Informix CDC Agent:
$ ./informixLEAShutdown.sh nologging
The following message is logged to the command window:
iwaycdcagent will be brought down and the logging will be turned off to allow Informix table changes
$ ./informixLEAShutdown.sh
The following message is logged to the command window:
./informixLEAShutdown.sh starting iwaycdcagent will be brought down but logging will remain on. iwaycdcagent has been brought down successfully with logging on
Note: If the iWay Informix CDC Agent unexpectedly shuts down, you will need to restart it using the -RESUME command to ensure that all records are picked up from the Last Sequence Number (LSN).
The output file that is generated by the iWay Informix CDC Agent is a text file containing XML data. There is a predefined XML format for every supported transaction record type:
The following is a sample XML record for the BEGIN_TX record type:
<transaction database="stores" table="informix.manufact" type="BEGIN_TX" lsn="52:0x14965bc" transactionid="25" transactiontime="2009-12-14 16:46:17"></transaction>
The following is a sample XML record for the COMMIT_TX record type:
<transaction database="stores" table="informix.manufact" type="COMMIT_TX" lsn="52:0x14968bc" transactionid="25" transactiontime="2009-12-14 16:46:17"></transaction>
The following is a sample of an INSERT transaction record in XML format:
<transaction database="stores" table="informix.customer" type="INSERT" lsn="52:0x1496624" transactionid="25"><column name="customer_num" type="SQLINT" key="true "><![CDATA[259]]></column><column name="fname" type="SQLCHAR" key="false"><![CDATA[John ]]></column><column name="lname" type="SQLCHAR" key="false"><![CDATA[King ]]></column><column name="company" type="SQLCHAR“ key="false"><![CDATA[iWay ]]></column><column name="address1" type="SQLCHAR" key="false"><![CDATA[2 Penn Plaza ]]></column><column name="address2" type="SQLCHAR" key="false"><![CDATA[Madison Sq. Garden ]]></column><column name="city" type="SQLCHAR" key="false"><![CDATA[New York ]]></column><column name="state" type="SQLCHAR" key="false"><![CDATA[NY]]></column><column name="zipcode" type="SQLCHAR" key="false"><![CDATA[10121]]></column><column name="phone" type="SQLCHAR" key="false"><![CDATA[222-333-4444 ]]></column></transaction>
iWay Informix CDC Agent writes the XML CDC data into a text file. The CDC data file name has the following format:
{$ CDC_BASENAME}_{$ CDC_SUBSCR_NAME}_YYYYMMDD_NNNN.${ CDC_OUT_EXT}
where:
Is the program name. The environment variable is set in the iwaycdc.env file (default) located in the config directory.
Is the subscription name. The environment variable is set in the subscrname.env file located in the config directory. It is passed to the iwaycdcagent program as an argument with the -S command line option.
Is the current date when the CDC data file is created.
Is the serial four-digit number. Starts with 0001, left padded by 0. Increments for a duration of the day, specified in the DATE above. Resets to 0001 at 00:00 am along with a new DATE, when a new CDC data file is created.
Is the extension of the CDC data file (.txt by default). The environment variable is set in the iwaycdc.env file (default) located in the config directory.
For example:
iwaycdc_subscr01_20091214_0015.txt
The CDC data files are located in the following directory (separate for every subscription):
${CDC_OUTPUTDIR}/${ CDC_SUBSCR_NAME}
iWay Informix CDC Agent Trace File Name has the same format as the CDC data file, but only uses a different extension.
The trace file extension (.trc by default) is set as an environment variable in the iwaycdc.env file (default) located in the config directory.
The trace files are located in the following directory (separate for every subscription):
${CDC_OUTPUTDIR}/${ CDC_SUBSCR_NAME}
iWay Software |