The replication support in an application is typically written with one or more threads of control looping on one or more communication channels, receiving and sending messages. These threads accept messages from remote environments for the local database environment, and accept messages from the local environment for remote environments. Messages from remote environments are passed to the local database environment using the DB_ENV->rep_process_message method. Messages from the local environment are passed to the application for transmission using the callback interface specified to the DB_ENV->set_rep_transport method.
Processes establish communication channels by calling the DB_ENV->set_rep_transport method, regardless of whether they are running in client or server environments. This method specifies the send interface, a callback interface used by Berkeley DB for sending messages to other database environments in the replication group. The send interface takes an environment ID and two opaque data objects. It is the responsibility of the send interface to transmit the information in the two data objects to the database environment corresponding to the ID, with the receiving application then calling the DB_ENV->rep_process_message method to process the message.
The details of the transport mechanism are left entirely to the application; the only requirement is that the data buffer and size of each of the control and rec DBTs passed to the send function on the sending site be faithfully copied and delivered to the receiving site by means of a call to DB_ENV->rep_process_message with corresponding arguments. The DB_ENV->rep_process_message method is free-threaded; it is safe to deliver any number of messages simultaneously, and from any arbitrary thread or process in the Berkeley DB environment.
There are a number of informational returns from the DB_ENV->rep_process_message method:
Copyright Sleepycat Software