Giter VIP home page Giter VIP logo

umbraco-8-hangfire's Introduction

Deprecated

deprecated No Maintenance Intended

This repository will no longer be maintained. I have created a private repository for use by Guru Digital Media to integrate with Umbraco9.

Hangfire scheduled tasks for Umbraco 8#

CI

This integrates https://github.com/HangfireIO/Hangfire with Umbraco v8 https://github.com/umbraco/Umbraco-CMS

Installation

Refer to Umbraco documentation to set up Umbraco development environment https://our.umbraco.com/download

NuGet

PM> Install-Package UmbracoHangfire

Manually

  • Add UmbracoHangfire project to your solution
  • Add project reference to UmbracoHangfire
  • Copy the contents of UmbracoHangfire\App_Plugins to the corresponding folder in your Umbraco project

Umbraco Integration

  • A Hangfire Tree node is added under Settings
  • Jobs are listed
  • Change Cron settings for any job
  • The Hangfire Dashboard can be accessed by admin users at [yoururl]/umbraco/hangfire

Example Usage

[RuntimeLevel(MinLevel = RuntimeLevel.Boot)]
public class DemoJob : IComposer
{
	public const string DemoJobName = "DemoJob";

	[HangfireJob("Demo Job")]
	public static void Execute()
	{
		// Add code to perform action here
		new HangfireDbContext().SaveHistory(DemoJobName, "Demo Job Completed Successfully", DateTime.Now);
	}

	/// <summary>
	/// Create job in startup of website
	/// </summary>
	public static void CreateRecurringJob()
	{
		// Create recurring job
		RecurringJobManager manager = new RecurringJobManager();
		RecurringJobDto job = HangfireJobForm.JobFromId(DemoJobName);
		if (job == null)
		{
			RecurringJob.AddOrUpdate(DemoJobName, () => DemoJob.Execute(), "0 0 * * *", TimeZoneInfo.Local);
		}
	}

	public void Compose(Composition composition)
	{
		HangfireStartup.HangFireStarted += HangfireStartup_HangFireStarted;
	}

	private void HangfireStartup_HangFireStarted(object sender, HangfireStartedArgs e)
	{
		CreateRecurringJob();
	}
}

umbraco-8-hangfire's People

Contributors

russellshome avatar dependabot[bot] avatar robgha01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.