ConfigurationTask Scheduler

Task Scheduler

Task Scheduler

Task scheduler is used for running the Sana Commerce specific tasks in background. It supports multiple tasks that can be performed simultaneously.

Task scheduler is configured in the 'sanaCommerce' configuration section of the backoffice web.config file.

<tasks taskStateConnectionStringName="LocalSqlServer">
   <task name="TaskTaskScheduler1"
      type="Sana.Commerce.Tasks.TestTask, Sana.Commerce.Tasks.TaskScheduler"
      interval="10"
      enabled="true"
   />
   <task name="TaskTaskScheduler2"
       type="Sana.Commerce.Tasks.TestTask, Sana.Commerce.Tasks.TaskScheduler"
       time="15:02"
       enabled="true"
   />
   <task name="KeepAliveTask"
       type="Sana.Commerce.Tasks.KeepAliveTask, Sana.Commerce.Tasks.TaskScheduler"
       interval="200"
       enabled="true"
       testURL="~/KeepAlive.aspx"
   /> 
</tasks>

To create a new task:

  • Copy the *.dll file of a task in the backoffice 'Bin' folder;
  • Add the new task to the web.config; 

Every task is configured individually. The following parameters can be set for the task (all of them are required):

  • name: the name of the task. Note: The task name should be unique for every task.
  • type: the name of a class which implements the ITask interface.
  • time/interval: advanced scheduling allows a task to be performed daily at a fixed time or every X minutes. The type of activity depends on the type of the variable specified for a task:

    For fixed time: time="15:02"
    For interval: interval="2000000"

    For fixed time the daytime of a server is used. The interval is set in seconds and specifies the period after which the task will be performed again.

  • enabled: activates or deactivates the task.

Task scheduler supports the 'keep alive' mechanism that periodically sends the request to the backoffice to keep the connection between the task scheduler tasks and the backoffice.

The 'keep alive' task has the additional parameter 'testURL' that specifies the target page for sending a request.

The name 'KeepAliveTask' is used in the task scheduler so it cannot be changed for the 'keep alive' task.

Logging is configured in the 'loggingConfiguration' section of the backoffice 'web.config' file. For the task scheduler the 'logging in a log file' method is used. You can read about it in the 'Enable logging' chapter of the 'Troubleshooting' section.

ConfigurationTask Scheduler