Sample implementation of the RepTransactionFormatter interface

Use the MessageFormatter.java file under <AppServer location>\repra\sample\client (Windows) or <AppServer location>/repra/sample/client (UNIX) directory as a sample of the customized message formatter. The sample uses the DBEventParser utility to retrieve data and metadata from the replication event. For detailed information about DBEventParser, see “Using the DBEventParserFactory”.

StepsCompiling the customized formatter processor

To compile your formatter processor.

  1. Go to the directory where your formatter processor is located.

    On Windows:

    cd c:\work\custom
    

    On UNIX:

    cd /work/custom
    
  2. Use the Java compiler, the -classpath parameter, and the required libraries to compile your customized class.

    On Windows:

    md customclasses
    c:\jdk141\bin\javac -classpath .;c:\sybase\EAServer\repra\lib\
    repraconn.jar \
    -d customclasses com\mycompany\SampleFormatter.java
    

    On UNIX:

     mkdir customclasses
    /usr/jdk141/bin/javac -classpath.:/opt/sybase/EAServer/repra/
    lib/repraconn.jar\
    -d customclasses com/mycompany/SampleFormatter.java
    
  3. Verify the compilation.

    When the compilation finishes without any error messages, go to the customclasses directory to see if the SampleFormatter.class is under com\mycompany (Windows) or com/mycompany (UNIX).

StepsBuilding the runtime environment for the customized formatter processor

To include the customized formatter processor in a jar file, go to the customclasses directory and use the jar command to build a jar format from the com directory. Otherwise, you can use the directory path for setting up your environment.

NoteSybase recommends that you use the jar file format for your customization.

  1. Build a jar file

    On Windows:

    cd C:\work\custom\customclasses
    C:\jdk141\bin\jar -cf mycustom.jar com
    

    On UNIX:

    cd /work/custom/customclasses
    /usr/jdk141/bin/jar -cf mycustom.jar com
    
  2. Shut down and restart your application server.

    For EAServer:

    1. Copy the jar file, or the directory structure containing the Java classes created from the previous step, to the EAServer java\classes (Windows) or java/classes (UNIX) directory.

    2. Run EAServer and connect to it from EAServer Manager.

    3. If you are using the jar file, go to the Servers/<your server> directory and select Server Properties. From the pop-up, select the Java Classes tab. Click Add to add the name of the jar file, such as mycustom.jar, and click OK.

    4. Shut down the EAServer, and then restart it to activate the new environment change.

    For WebLogic:

    1. Shut down the application server if it is running.

    2. Add the full path of mycustom.jar or the customclasses directory to CLASSPATH at the end of the CLASSPATH definition in %BEA_HOME%\repra\bin\repra_env.bat (Windows) or $BEA_HOME/repra/bin/repra_env.sh (UNIX):

      On Windows:

      set CLASSPATH=C:\work\custom\customclasses;%CLASSPATH% 
      or 
      set CLASSPATH=C:\work\custom\customclasses\mycustom.jar;%CLASSPATH%
      

      On UNIX:

      set CLASSPATH=/work/custom/customclasses:$CLASSPATH 
      or 
      set CLASSPATH=/work/custom/customclasses/mycustom.jar;$CLASSPATH
      
    3. Start the WebLogic Server to activate the new environment change.