Tuesday, November 30, 2010

Task Scheduler Engine

This past weekend I published a small open source project at CodePlex, Task Scheduler Engine. It is a simple cron-like scheduling API with a clean fluent interface (also supports XML config, if you prefer typing out assembly qualified names). Use it when you need a simple, in-memory scheduler and when you need tasks to execute at a specific second (in other words, if you start doing math to compute the duration of your timer so that it fires at a specific time, use this instead). If you have multiple services load balanced to execute tasks, this isn’t for you.

Here’s all that’s required to schedule a task (write console output) to execute every ten seconds:

var s = new Schedule()
    .AtSeconds(0, 10, 20, 30, 40, 50)
    .WithLocalTime()
    .Execute<ConsoleWriteTask>();

SchedulerRuntime.Start(s);

Creating your own tasks is just as easy—implement ITask, which has an Initialize method and a Handle method that is called at the scheduled time.

It compiles to an 18KB assembly, has no external (non-framework) dependencies, and is just over 250 lines of code. Add clean, simple scheduling to your .NET application.

Sunday, November 14, 2010

Travis Cooks

I started a new blog over at www.traviscooks.com. Imagine me with a cameraphone uploading quick summaries of what I'm cooking.

On the subject of food, I run Kefirpedia.org, a site where I drop all of my knowledge and research about kefir. If you don't know what kefir is, it's a wonderful probiotic fermented milk beverage—imagine a super yogurt.