Below is the example of using the SetScheduler operation to start container's tasks execution. The request contains the scheduled tasks container moniker and the pattern indicating whether tasks must be started. The list of tasks to be started is also sent. The response contains execution results.
{ "SetScheduler" : { "tScheduler" :
{ "id" : "S1!M!6445" }, "tArg" : { "pattern" : { "obInst" : "true", "execTasks" : "true" },
"meta" : { "tasks" : { "its" : { "it" : [ { "k" : "6449",
"id" : "RUN_MODULE", "n" : "Module execution", "vis" : "true", "type" : "ExecuteSub", "properties" : { "period" : { "type" : "Daily", "startDateTime" : "2000-01-01T00:00:00"
"stopDateTime" : "2010-01-01T00:00:00", "everyDays" : "1" }, "active" : "false", "queueing" : "false", "userTag" : "ADMIN", "threadClass" : "1", "publishing" : { "mailAddress" : "",
"mailSubject" : "&[TASK_RESULT] - &[TASK_FINISH] : &[TASK_NAME]", "mailBody" : "&[TASK_RESULT] - &[TASK_FINISH] : &[TASK_NAME]", "ftpAddress" : "", "appendAttachment" : "true" }, "paramValues" : "" }, "settings" : { "fore" :
{ "subName" : "Run" } } } ] } } }, "metaGet" :
{ "obInst" : "true", "tasks" : "Get", "task" : { "result" : "true" } } } } }
{ "SetSchedulerResult" : { "id" : { "id" : "S1!M!6445" },
"execResults" : { "its" : { "it" : [ { "k" : "6449", "id" : "RUN_MODULE", "startDate" : "2013-12-06T15:59:13.000",
"finishDate" : "2013-12-06T15:59:14.000", "state" : "Inactive", "messages" : "" } ] } }, "meta" : { "obInst" :
{ "obDesc" : { "@isShortcut" : "0", "@isLink" : "0", "i" : "TASKS_CONTAINTER", "n" : "Scheduled tasks container", "k" : "6445", "c" : "5378", "p" : "6444",
"h" : "0" } }, "tasks" : { "its" : { "it" : [ {
"k" : "6449", "id" : "RUN_MODULE", "n" : "Module execution", "vis" : "1", "type" : "ExecuteSub", "result" : { "k" : "6449", "id" : "RUN_MODULE", "startDate" : "2013-12-06T15:59:13.000"
"finishDate" : "2013-12-06T15:59:14.000", "state" : "Inactive", "messages" : "" } } ] } } } } }
The ExecuteTasks function specified below starts execution of tasks available in the scheduled tasks container and gets execution results. The container instance moniker and the list of tasks are sent as input parameters. The function body must contain the pattern indicating whether tasks must be executed. The result of the function is the result of the operation.
public static SetSchedulerResult ExecuteTasks(SchedulerId moniker, SchedulerTasks tasks) { var somClient = new SomPortTypeClient(); // Proxy object for operation execution //Operation execution parameters var tSet = new SetScheduler() { tScheduler = moniker, tArg = new SetSchedulerArg() { pattern = new SchedulerMdPattern // Metadata extraction pattern
{ execTasks = true, }, meta = new SchedulerMd() { tasks = tasks }, metaGet = new SchedulerMdPattern() { tasks = ListOperation.Get,
task = new SchedulerTaskPattern() { result = true } } } }; //Execute tasks var tResult = somClient.SetScheduler(tSet); return tResult; }
See also: