Sample implementation of the RepTransactionFormatter interface

Use the MessageFormatter.java file under <AppServer location>/repra/sample/client 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 see “Using the DBEventParserFactory”.

StepsCompiling the customized formatter processor

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

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

     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 verify that the SampleFormatter.class exists in com/mycompany.

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 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:

    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 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. 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 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 the end of the CLASSPATH definition in $BEA_HOME/repra/bin/repra_env.sh:

      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.