13 Using the Java User Exit

This chapter describes how to start and restart the Oracle GoldenGate Adapter user exit that delivers messages. It assumes that the primary Extract has already generated a trail to be consumed by the user exit Extract.

This chapter includes the following sections:

13.1 Starting the Application

To run the user exit and execute the Java application, you only need an existing trail file and its corresponding source definitions file. For the examples that follow, a simple TCUSTMER and TCUSTORD trail is used (matching the demo SQL provided with the Oracle GoldenGate software download), along with a source definitions file defining the data types used in the trail.

Note:

The user exit does not require access to a database in order to run. But the Extract process does require metadata describing the trail data. Either the Extract must login to a database for metadata, or a source definitions file can be provided. In either case, the Extract cannot be in PASSTHRU mode when using a user exit.

To run the user exit, simply start the Extract process from GGSCI:

GGSCI> START EXTRACT javaue
GGSCI> INFO EXTRACT javaue

The INFO command will return information similar to the following:

EXTRACT JAVAUE Last Started 2011-08-25 18:41 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint File ./dirdat/bb000000
2011-09-24 12:52:58.000000 RBA 2702

If the Extract process is running and the file handler is being used (as in the example above), then you should see the output file output.xml in the Oracle GoldenGate installation directory (the same directory as the Extract executable).

If the process does not start or abends, see Section 18.1, "Checking for Errors."

13.2 Restarting the Application at the Beginning of a Trail

There are two checkpoints for an Extract running the user exit: the user exit checkpoint and the Extract checkpoint. Before rerunning the Extract, you must reset both checkpoints:

  1. Delete the user exit checkpoint file.

    In this example the name of the Extract group is javaue, so this will default to the checkpoint prefix. The prefix can also be set in the properties file using goldengate.userexit.chkptprefix.

    Windows: cmd> del javaue_jvm.chkpt

    UNIX: $ rm javaue_jvm.chkpt

    Note:

    Do not modify checkpoints or delete the user exit checkpoint file on a production system.
  2. Reset the Extract to the beginning of the trail data:

    GGSCI> ALTER EXTRACT JAVAUE, EXTSEQNO 0, EXTRBA 0
    
  3. Restart the Extract:

    GGSCI> START JAVAUE
    GGSCI> INFO JAVAUE
    EXTRACT    JAVAUE    Last Started 2011-08-25 18:41   Status RUNNING
    Checkpoint Lag       00:00:00 (updated 00:00:00 ago)
    Log Read Checkpoint  File ./dirdat/ps000000
                         2011-09-24 12:52:58.000000  RBA 2702
    

    It may take a few seconds for the Extract process status to report itself as running. Check the report file to see if it abended or is still in the process of starting:

    GGSCI> VIEW REPORT JAVAUE