devatwork/Premotion-Mansion — pull request #187 by Erikvl87 (2014-10-25 22:52:47+00:00)
Title: Add a scheduler service to the framework

# **Quartz.NET Scheduler:**
I have implemented the Quartz.NET Enterprise Scheduler to the framework.
http://www.quartz-scheduler.net/

I've added two types to the project.
* Scheduler
* Job

The Scheduler holds Jobs. On each Job, multiple Tasks can be registered using an xtype descriptor. The descriptor asks for a Task name and the fully qualified class name of the Task.

I've added an abstract Task class that needs to be inherited from. This class implements the Quartz IJob interface. The only thing that is needed to create a Task is to implement the member DoExecute().

For now, I have only implemented a simple scheduler trigger, that takes these three arguments:
* seconds
* minutes
* hours

These settings can be configured on the xform.

Because multiple Tasks can be configured per Job, the xform will show the status of each Task separately. It will show if the Task ran successfully, if it gave any exceptions and the Task output (if present).

# **Known bugs:**
* For the trigger to work, issue #185 needs to be merged.
* Because Tasks will run simultaneously, when the Job Node status gets updated, it could happen that the Task status get's overwritten by another Task. This is because both Tasks hold a cached Job Node. I would like to discuss this problem with you, @devatwork

# **Features:**
I also have some features I would like to build in later on:
* Add more complex triggers (for example, scheduling on exact moments)
* Mail alerts (for example, when a Task fails)

# **Example:**
I've added an example type called **ExampleJob** to the TestWebApp project.
This Job has two Tasks. One of the tasks will always fail (**FailingTask**), to demonstrate the exception handling. The other one (**ExampleTask**) will divide random numbers, and could fail or run successfully, depending on the randomly selected divider, that could be zero.

# **Screenshot:**
![job](https://cloud.githubusercontent.com/assets/1898162/4781345/5cf0d47a-5c99-11e4-9487-4732715a9f1e.JPG)