Managing web farm synchronization tasks

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can create a new web farm synchronization task of a predefined task type and add it to the system:

 

[C#]

 

using CMS.SettingsProvider;

 

...

     

        // Set parameters

        string taskTarget = "";

        string taskTextData = null;

        byte[] taskBinaryData = null;

        WebFarmTaskTypeEnum webfarmTaskType = WebFarmTaskTypeEnum.ClearHashtables;

 

        // Create web farm task

        WebSyncHelperClass.CreateTask(webfarmTaskType, taskTarget, taskTextData, taskBinaryData);

 

The following sample code shows how you can process an existing web farm synchronization task:

 

[C#]

 

using CMS.WebFarmSync;

using CMS.WebFarmSyncHelper;

 

...

 

        // Get web farm task

        WebFarmTaskInfo wfti = WebFarmTaskInfoProvider.GetWebFarmTaskInfo(10);

 

        // If task exists

        if (wfti != null)

        {

            // Process task

            WebSyncHelper.ProcessTask(wfti.TaskGUID);

        }

 

The following sample code shows how you can process all web farm synchronization tasks assigned to the current server (the server that is specified by code name in the web.config file):

 

[C#]

 

using CMS.WebFarmSyncHelper;

 

...

 

        // Process all tasks for server in web.config

        WebSyncHelper.ProcessMyTasks();

 

The following sample code shows how you can delete an existing web farm synchronization task:

 

[C#]

 

using CMS.WebFarmSync;

 

...

 

        // Get web farm task

        WebFarmTaskInfo wfti = WebFarmTaskInfoProvider.GetWebFarmTaskInfo(10);

 

        // If task exists

        if (wfti != null)

        {

            // Remove from database

            WebFarmTaskInfoProvider.DeleteWebFarmTaskInfo(wfti.TaskID);

        }

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_managing_web_farm_synchronization_tasks.htm