Previous Topic: Stopping Scenarios: stop()Next Topic: Finishing Work: close_session()


Pausing Data Replication: suspend_replication()

The suspend_replication API function lets you suspend replication operations for a host.

Arguments

The suspend_replication API function includes the arguments described in the following table:

Name

Type

Description

session_id

uint

The session ID that was returned by calling the create_session API.

scenario_id

uint

The scenario ID to be suspended.

replica_index

uint

The replica host index in a scenario. Typically, the value of the replica index is 2.

execute_sync

bool

Regulates whether to call this API synchronously or asynchronously. When you set this argument to true, the API function will not return a value until the operation completes. Otherwise, the function return a value immediately.

message

out string

Contains the reason for failure when this API fails.

Return Values

The return type is Boolean. When the return value is true, the API completed successfully. When the return value is false, the API did not complete successfully. If the return value is false, review the message to determine the reason the API failed.

Example

public bool suspend_replication_example()
        {
            try
            {
                uint scenario_id = _scenario_id;
                string message = "";
                bool execute_sync = true;
                uint replica_index = 2;
                return get_mng().suspend_replication(_session_id, scenario_id, replica_index, execute_sync, out message);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            return false;
        }