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); } |