Hit enter to search

  • Noida
  • London
  • Leeds
  • USA
  • Durham
  • Spain

Handling Task Scheduling in Umbraco

If you are an Umbraco user, then there may be times when you would want to schedule a task in the .Net framework. You may need to run some codes every night at a particular time for calling a service, sending messages, creating a report or etc. In order to do such work, one has to create a batch file and run it with a solution, but in certain situations, it may not work properly.

Some web application should be able to trigger the task to occur according to the set times. A good scheduler should be able to do all these:

  • Create reoccurring tasks
  • Easily set a date and time for a task to occur in future
  • Allow error handling
  • Enable access to the UI that can be used and understood by everyone
  • Schedule one off task

Handling Task Scheduling

Some other tasks that you might want your task scheduler to include:

Small border for heading and paragraphs with multiple colors

  • Sending some emails to users who were inactive for a time
  • Triggering the CSV imports in order to update the site content
  • Repeat orders or payments occur

Umbraco development has a built in function to handle task scheduling. But this is very basic and heavily relies on publicly available URLs in order to trigger the task. It has limitations to a recurring task, which can only be fired on a fixed interval so there is no real scheduling option. This can be achieved by adding the codes to the Umbracosettings.config file. It works by visiting the URL at the fixed interval, but this method has many drawbacks.

The Drawbacks are:

  • To find out if the triggered task is completed is to check the Umbraco log which is not very transparent
  • It is difficult to set a specific time for the task to occur
  • There may be chances that two instances of the same task run simultaneously as there is no method to check for any existing running task.
  • The task can be interrupted by a website or a server restart

So What is the Solution Now?

Tasks can be scheduled in a few ways in Umbraco and here are the options before you:

Hangfire:

This is a multi-threaded task scheduler that is built on the client server architecture on .NET stack. It offers rich features for task scheduling and includes a beautiful UI that can be accessed via the browser. The UI tells you when the tasks have been called, completed and if there is any error. It assumes that you have a MS SQL database and setting it to use the database is a simple task.

Quartz:

This is a .NET scheduler and can be integrated with a wide range of Java applications. It is basically used for enterprise class applications in order to support the process workflow, system management actions and etc. All the tasks can either be stored in the memory, or Quartz can be configured to save the task to the database.

The first option is simple to setup, but it would require the Umbraco developer to schedule the task on site startup, in case you want to have some commonly occurring tasks.

 

Windows task scheduler:

This is a component of the MS windows that offers the ability to schedule the launch of any programs at some pre-defined time or after any specific time interval. This is very similar to the solution that Umbraco has in-built, but it comes with some more advantages like the task scheduling is not affected by the site or server restart.

Call Us + 91 120 423 5665
Leave your name and mobile number, We will call you back

    × Ask An Expert