The synchronization process is usually initiated by, and is largely controlled from, the replica database. If you need master-initiated synchronization, you can use the Sync Pull Notify feature, which allows the master to notify the replica that it is time to start a synchronization operation. For details about Sync Pull Notify, see Sync Pull Notify.
The creation and execution of a synchronization process follows this pattern:
1 Create a message by giving a unique name to it. For example:
MSGNAME := GET_UNIQUE_STRING(’MSG’);
Note that the autocommit mode must be switched off.
2 Append the synchronization tasks (propagate transactions and refresh from publications) to the message. Any number of tasks can be included in the message.
3 End the message and make it persistent by committing the transaction. From this point on, the store and forward messaging architecture guarantees that data contained by the message will not be lost.
4 Forward (send) the message to the master database.
The reply message can be received as part of the forward command. This is a useful approach if the reply message can be expected within a reasonable amount of time, for example, within a minute. Alternatively, if the reply is expected much later, for example, the next morning, the reply can be requested using a separate GET REPLY command.
Executing a typical synchronization process
-- Create a new message with name 'my_msg'. -- AUTOCOMMIT must be off! Also, any preceding transaction must be -- completed prior to executing the MESSAGE statements. MESSAGE my_msg BEGIN ; -- Append tasks to message: propagate transactions. MESSAGE my_msg APPEND PROPAGATE TRANSACTIONS ; -- Append tasks to message: refresh from publications. MESSAGE my_msg APPEND REFRESH ORDERS_BY_SALESPERSON ('1') ; MESSAGE my_msg APPEND REFRESH PARTS_IN_INVENTORY ; -- End the message, make it persistent. MESSAGE my_msg END ; -- Commit the message creation operation. COMMIT WORK ; -- Send the message to master, do not wait for reply. MESSAGE my_msg FORWARD ; -- Request reply to the message separately from master. -- Wait for the reply message for a maximum of 100 seconds. MESSAGE my_msg GET REPLY TIMEOUT 100 ; COMMIT WORK ;