Queueing: Boolean;
The Queueing property determines whether the task is launched when the previous instance of the same task is not completed. If the value is True, the task is not launched until the previous instance is not completed, if False, the task is launched in any case.
NOTE. In case if one or more of its next launching are missed when executing the task, they will be performed in turn.
Executing the example requires the scheduled tasks container with the TASK_CONTAINTER identifier and the module with the Module_1 identifier in repository. The module contains the Main procedure.
Sub Main;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Exe: IExecuteSubScheduledTask;
Per: IScheduledTaskPeriodDaily;
Prop: IScheduledTaskProperties;
Date: DateTime;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTESUB;
CrInfo.Id := "MODULE_EXECUTOR";
CrInfo.Name := "Module execution";
CrInfo.Parent := MB.ItemById("TASK_CONTAINTER");
MObj := MB.CreateObject(CrInfo).Edit;
Exe := MObj As IExecuteSubScheduledTask;
Exe.Assembly := (MB.ItemById("Module_1").Bind As IModule).Assembly;
Exe.SubName := "Main";
Prop := Exe.Properties;
Per := Prop.CreatePeriod(ScheduledTaskPeriodType.Daily) As IScheduledTaskPeriodDaily;
Per.EveryDays := 3;
Date := DateTime.Now;
Per.StartDateTime := Date.Compose(Date.Year, Date.Month, Date.Day, 12, 0, 0, 0);
Per.StopDateTime := DateTime.AddMonths(Per.StartDateTime, 2);
Prop.Period := Per;
Prop.Queueing:=True;
MObj.Save;
End Sub Main;
After executing the example a new task of module execution is created in the scheduled tasks container. The module is launched every three days at 12:00 during two months. The task will not be launched, until the previous instance of the same task is completed.
See also: