Product Documentation

c-treeACE V11.0 Update Guide

Previous Topic

Next Topic

External Notification of Replication Agent Events

In V11 and later, the Replication Agent supports a configuration option, notify_events yes, that triggers execution of an external program. This external execution can be a Windows batch file, Unix shell script, or executable and is expected to be named replmon. When an event in the list of event codes below occurs replmon is called.

Two string values are passed to replmon upon event notification: an error code and one of the numeric event codes listed below. replmon can then process this exception notification as appropriate for the environment.

  1. Replication Agent is starting
  2. Replication Agent is shutting down
  3. Replication Agent is entering paused state
  4. Replication Agent is resuming operation
  5. Replication Agent connected to source server
  6. Replication Agent connected to target server
  7. Replication Agent lost connection to source server
  8. Replication Agent lost connection to target server
  9. Replication Agent disconnected from source server
  10. Replication Agent disconnected from target server
  11. Replication Agent terminating due to exception

Example

In the example below, replmon.bat logs the date, time, event description, and error code to the file replevent.log:


@echo off

if "%1" == "1" (

set evdesc=Replication agent is starting.

) else if "%1" == "2" (

set evdesc=Replication agent is shutting down. Error code %2.

) else if "%1" == "3" (

set evdesc=Replication agent has been paused.

) else if "%1" == "4" (

set evdesc=Replication agent is resuming normal operation.

) else if "%1" == "5" (

set evdesc=Replication agent connected to source server.

) else if "%1" == "6" (

set evdesc=Replication agent connected to target server.

) else if "%1" == "7" (

set evdesc=Replication agent lost connection to source server. Error code %2.

) else if "%1" == "8" (

set evdesc=Replication agent lost connection to target server. Error code %2.

) else if "%1" == "9" (

set evdesc=Replication agent disconnected from source server.

) else if "%1" == "10" (

set evdesc=Replication agent disconnected from target server.

) else if "%1" == "11" (

set evdesc=Replication agent terminating due to exception. Exception code %2.

) else (

set evdesc=Replication agent event code %1. Error code %2.

)

for /f "usebackq tokens=*" %%j in (`date /t`) do set dt=%%j

for /f "usebackq tokens=*" %%j in (`time /t`) do set tm=%%j

echo %dt%%tm% %evdesc% >> replevent.log

On Windows the Replication Agent installs an exception handler so it can notify the external process if an unhandled exception occurs.

TOCIndex