Job Scheduler
The configuration of setting a scheduled job
In Litium, we can schedule multiple tasks with specific time and interval.
Litium 7 and previous versions
The schedule class is the place that we run the job. This class should implement ITask interface.
public class AuditCleanupScheduler : ITask
{
void ITask.ExecuteTask(SecurityToken token, string parameters)
{
//do something
}
}
The configuration for job scheduler will be created in Litium.Accelerator.Mvc - web.config, under Litium node
<litium>
<foundation>
<taskSettings>
<scheduledTasks>
<scheduledTask type="Litium.Foundation.Modules.ProductCatalog.Products.AuditCleanupScheduler, Litium.Studio" startTime="00:45" interval="1d" parameters="Trace=1" />
</scheduledTasks>
<startupTasks>
</startupTasks>
</taskSettings>
</foundation>
</litium>
In the example above, the AuditCleanupScheduler has been registered. It will run at 00:45. And the interval is set to 1 day, and the parameter is “trace=1”. The AuditCleanupScheduler will use the parameters that were passed from the configuration.
In version 8, Litium switches to asp.net core. After that the configuration of setting a scheduled job will not be the same in different versions.