Skip to main content

C replication extension API

This section describes using the replication extension library with the original Replication Agent. The extension library can be also used with the newer Replication Manager. For procedures, contact us.

FairCom replication supports loading a user-defined external library that can perform customized actions when processing replication operations. The library contains functions that are called when certain predefined events occur.

This feature allows a software developer to customize the Replication Agent's behavior to support capabilities such as:
  • Conflict detection and resolution

    At their core, replication solutions need to copy data from a source server to a target server to provide a failover server, maintain backup copies, or create an environment for testing or reporting. A foremost consideration is detecting and resolving conflicts between the data on the source and target servers. The Replication Agent is able to provide basic default handling of conflicts; however, many situations require adherence to individual corporate procedures based on proprietary business logic. The extension library allows developers to provide specialized logic to handle these situations according to your corporate policies.

  • Data transformation

    Closely related to conflict detection, some replication environments must accommodate replication between non-identical data stores — for example, it may sometimes be necessary to replicate between databases with different schemas. The extension library can be used to provide functions that transform the source data to comply with the schema of the target data.

    Example 1. Sever offline during a schema upgrade

    Suppose a replicated server is taken offline and a schema upgrade is performed on it. Because it now has a newer schema than the other replicated servers, the extension library could transform the data structure from the original server to the upgraded server.

    Note

    Be sure to also consider the use of FairCom’s new Hot Alter Table logic for helping to solve this scenario.



  • Filter or redirect data updates

    In the Example 1, “Sever offline during a schema upgrade, an alternative strategy could be to selectively replicate to the updated server. In this case, the extension library could be used to filter out the data that should not be replicated.

  • Replicate to a third-party database

    When replicating to a third-party database, the extension library could be used to translate replication operations into inserts and updates to be applied to the third-party database.

Replication Agent extension library SDK

The Replication Agent extensions are provided by an application developer within an SDK framework in an external library loaded by the Replication Agent at runtime. When a user-defined extension library is used, the Replication Agent calls a function in the external library for each operation that it reads from the source server. The function can modify the operation values, or take custom actions, and it can indicate to the agent what action to take for that operation. To use this feature, the developer needs access to FairCom DB Professional and to a development environment that supports writing and compiling C code into a DLL or shared library.