3 votes

Cultiv.Hangfire

Note: version 1 is compatible with Umbraco 9 and version 2 is compatible with Umbraco 10 and up.

This installs Hangfire and a dashboard in Umbraco, the dashboard is secured and is only available for users with access to the Settings section of Umbraco.

As of v2.0.1, you can now use a separate database for Hangfire, the connection string name then should be: hangfireDB.

For more info:

After installing this package, you can start creating Jobs from a composer, for example:

using System.Threading;
using Hangfire;
using Hangfire.Console;
using Hangfire.Server;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;

namespace MyNamespace
{
    public class Composer : IComposer
    {
        public void Compose(IUmbracoBuilder builder)
        {            
            RecurringJob.AddOrUpdate(() => DoIt(null), Cron.Hourly());
        }
        
        public void DoIt(PerformContext context)
        {
            var progressBar =  context.WriteProgressBar();
            var items = new int[10]{ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };

            foreach (var item in items.WithProgress(progressBar, items.Length))
            {
                context.WriteLine($"Number: {item}");
                Thread.Sleep(1000);
            }
        }
    }
}

Screenshots

NuGet install instructions for Umbraco 9+

dotnet add package Cultiv.Hangfire

Package owner

Sebastiaan Janssen

Sebastiaan Janssen

Sebastiaan has 15522 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Works on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Sebastiaan Janssen
  • Created: 19/09/2021
  • Current version 2.1.0
  • License MIT
  • Downloads on Our: 0
  • Downloads on NuGet: 104.3K
  • Total downloads : 104.3K

External resources