本文整理汇总了C#中IScheduler.TriggerTaskByClassName方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.TriggerTaskByClassName方法的具体用法?C# IScheduler.TriggerTaskByClassName怎么用?C# IScheduler.TriggerTaskByClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScheduler
的用法示例。
在下文中一共展示了IScheduler.TriggerTaskByClassName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdminModule
public AdminModule(IScheduler scheduler, LogsStore logsStore, CreativePackagesStore creativePackagesStore,Logger logger,OmniRecordManager omniRecordManager)
: base("/admin")
{
Get["/hello"] = x => Response.AsText("OK");
Get["/fire-task/{job}"] = x =>
{
scheduler.TriggerTaskByClassName((string)x.job);
return Response.AsText("OK");
};
Get["/postfix-logs"] = x =>
{
var logs = logsStore.GetAllLogs();
var lines = logs.Select(entry => string.Format("{0} {1}", entry.time.ToLongTimeString(), entry.msg)).ToList();
return Response.AsText(string.Join(Environment.NewLine, lines));
};
Get["/jobs"] = x =>
{
var tasks = scheduler.GetCurrentJobs();
var data = tasks.Select(jobKey => new { Data = scheduler.GetJobDetail(jobKey).JobDataMap, Job = jobKey.Name }).ToList();
return Response.AsJson(data);
};
Post["/flush-unprocessed-packages"] = _ =>
{
var packages = creativePackagesStore.GetAll();
packages.ToList().ForEach(x =>
{
x.Processed = true;
logger.Info("write false for: {0}",x.To);
creativePackagesStore.Save(x);
});
return Response.AsText("OK");
};
Get["/purge-blocking-rules"] = _ =>
{
omniRecordManager.RemoveSingle<GroupsAndIndividualDomainsSendingPolicies>();
return "OK";
};
}