Task Runner

Task Runners are the classes that will host and execute the ITask implementation. These classes are inherited from TaskRunner. There are 4 TaskRunner currently implmented in the framework viz.

ParallelTaskRunner - As name suggests this TaskRunner is capable of running the Task in parallel based on the configuration of the Task and capacity of the machine. This can be used for Consumer type tasks which are consuming data from either queue or from work basket etc. The tasks are executed in parallel as the work load increases and reduces when the work load come down.

TimerTaskRunner - As name suggests this TaskRunner is capable of running the Task at a specified time interval. It also provides the additional configurability of defining the tiime window of a day spread and also time window of hours spread with in a day. E.g. The Task should run between 3/1/2013 thru 3/31/2013 and between 13:00:00 thru 13:15:00 at a interval of 15 mins (900,000 milliseconds). This will guarantee that the task will run between 1 - 1:15 PM everyday between 3/1/2013 thru 3/31/2013.

EventTaskRunner - This TaskRunner provides you with the configuration that when an event occurs in the system the Task is executed. You can wire this task with the event of the other task. It also allows you to configure whether it will be run synchronously or asynchronously in the background.

ScheduledTaskRunner - This TaskRunner enables you to configure a recurring task. It implements Daily, Weekly and Monthly recurring for the tasks.
  • Daily - Enables the task to run Daily and by configuring the repeat it lets you skip occurrence. E.g. if the repeat is 3 then the task will run every 3 days starting from the date given in startDate attribute
  • Weekly - Enables the task to run Weekly, you configure the week days when the task should run by providing schedule string. For weekly task the schedule string looks like "WD:Monday, Thursday, Saturday" the lets task to run every Monday, Thruday and Saturday. In addition, you can also provide the repeat attribute to skip weeks, e.g. by providing repeat 2 will lets the task run Monday, Thursday & Saturday of every other week starting from the date provided in startDate
  • Monthly - Monthly provided 2 ways to configure viz by week or by days. If you configure by weeks, you need to provide weekdays and the week of the month. So the schedule string look like "MN:January, March|WD:Monday, Friday|WK:Second,Last". This configuration lets the task to run second and last, Mondays and Friday in January & March. If you choose to configure by days the schedule string looks like "MN:January, February, March|DY:1,5,Last", this lets the task run on 1st, 5th and last day of January, February & March. The last day is calculate depending on month and year like February last day can be 28th for regular and 29th for leap year. In addition, repeat will let you skip the occurrence

Each batch or process allows you to host one or more Task that can execute in a single process. This enables you to share single Windows Service doing multiple tasks.

Last edited Mar 20, 2013 at 5:45 PM by slolam, version 7


No comments yet.