Content Staging and Synchronizing

Ei Dar Li Ko Ko asked on March 17, 2016 11:25

To set up the content staging between two servers, we used the content synchronization scheduled tasks to sync it two times daily. But we notice that there are some tasks which are still not sync and does not have any failed error message beside it. Any one has a suggestion why this is happen? Mostly the tasks that are not sync are changes on the custom table.

Correct Answer

Juraj Ondrus answered on March 17, 2016 11:58

Hello,
The scheduled task for staging supports only page content sync. Please see the documentation which says: "The scheduled task only synchronizes page changes. You cannot use the default Content synchronization task to synchronize changes of custom table data or objects."

For other objects - other task types you need to create a custom scheduled task.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Ei Dar Li Ko Ko answered on March 17, 2016 13:10

Hi Juraj, Thank you. I created the custom task with below code. But after one time run, whenever there is object changes it straightaway send to other server not even log the task in staging module anymore or wait for the next schedule run time.

public string Execute(TaskInfo ti) { if (ti.TaskEnabled == true) {

            // Assigns a handler to the StagingEvents.LogTask.After event
            // This event occurs after the system creates content staging synchronization tasks (separately for each task)
            StagingEvents.LogTask.After += LogStagingTask_After;


            string detail = "Staging Executed Testing";

            // Logs the execution of the task in the event log.
            EventLogProvider.LogInformation("CustomStagingTask", "Execute", detail);
        }

        return null;
    }

// Automatically synchronizes staging tasks private void LogStagingTask_After(object sender, StagingTaskEventArgs e) { // Gets the target server ServerInfo targetServer = ServerInfoProvider.GetServerInfo("MyServer", SiteContext.CurrentSiteID);

if ((targetServer != null) && (e.Task != null))
{
    // Synchronizes the processed staging task to the target server
    StagingHelper.RunSynchronization(e.Task.TaskID, targetServer.ServerID);
}

}

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.