BackgroundScheduler (Miscellaneous)

The BackgroundScheduler component provides you with a simple and robust method to get your web application to perform regular tasks in the background without any interference with your visitors.

These regular background tasks may include:
– Sending emails on a regular basis.
– Regular temp folder clean-up.
– Downloading RSS feeds of another website.
– Creating your own RSS feeds as static html files regularly.
– Connect to web services to update your copy of their data.

Not only regular tasks, but time consuming tasks or calculations can be initiated in the background. Once they are completed you can notify your visitors that the reasult is available for download.
These tasks may include:
– Creating PDF files.
– Sending an email while you can return to your visitor immediately with a response.
– Running lengthy SQL queries (Generating database backup).
– Process uploaded data (images, video, etc.)

The component can be used in Windows Forms applications as well. The current sample is running in .NET 2.0 framework but is can be used in later versions as well.
Activation a background task could not be any more simple:

BackgroundEvent BE = new BackgroundEvent(“TheNameOfTheEvent”);
BE.RepeatInterval = 300;
BE.EventHandler = ScheduledEvent;
BE.Start();

The methot to be executed regularly:

public void ScheduledEvent(BackgroundEvent BE) {

// Anything you would like to be done

}

Initialization to be put in the Global.asax file:

protected void Application_Start(object sender, EventArgs e) {

BackgroundScheduler.Init();
SampleEventManager.Init();
}

protected void Application_End(object sender, EventArgs e) {

BackgroundScheduler.Stop();
}

You can have as many scheduled even at you like. Events are not absolutely scheduled in time. The focus is on regularity and background execution. You can, however, re-schedule the events anytime. Events are not ecexuted parallel, rather one by one.

Download BackgroundScheduler (Miscellaneous)

Leave a Reply

Your email address will not be published. Required fields are marked *