Hangfire.Core 1.8.16
Hangfire
Build Status
main |
dev |
|
---|---|---|
AppVeyor |
Overview
Incredibly easy way to perform fire-and-forget, delayed and recurring jobs in .NET applications. CPU and I/O intensive, long-running and short-running jobs are supported. No Windows Service / Task Scheduler required. Backed by Redis, SQL Server, SQL Azure and MSMQ.
Hangfire provides a unified programming model to handle background tasks in a reliable way and run them on shared hosting, dedicated hosting or in cloud. You can start with a simple setup and grow computational power for background jobs with time for these scenarios:
- mass notifications/newsletters
- batch import from xml, csv or json
- creation of archives
- firing off web hooks
- deleting users
- building different graphs
- image/video processing
- purging temporary files
- recurring automated reports
- database maintenance
- …and so on
Hangfire is a .NET alternative to Resque, Sidekiq, delayed_job, Celery.
Installation
Hangfire is available as a NuGet package. You can install it using the NuGet Package Console window:
PM> Install-Package Hangfire
After installation, update your existing OWIN Startup file with the following lines of code. If you do not have this class in your project or don't know what is it, please read the Quick start guide to learn about how to install Hangfire.
public void Configuration(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("<connection string or its name>");
app.UseHangfireServer();
app.UseHangfireDashboard();
}
Usage
This is an incomplete list of features; to see all of them, check the official site and the documentation.
Dedicated worker pool threads execute queued background jobs as soon as possible, shortening your request's processing time.
BackgroundJob.Enqueue(() => Console.WriteLine("Simple!"));
Scheduled background jobs are executed only after a given amount of time.
BackgroundJob.Schedule(() => Console.WriteLine("Reliable!"), TimeSpan.FromDays(7));
Recurring jobs have never been simpler; just call the following method to perform any kind of recurring task using the CRON expressions.
RecurringJob.AddOrUpdate(() => Console.WriteLine("Transparent!"), Cron.Daily);
Continuations
Continuations allow you to define complex workflows by chaining multiple background jobs together.
var id = BackgroundJob.Enqueue(() => Console.WriteLine("Hello, "));
BackgroundJob.ContinueWith(id, () => Console.WriteLine("world!"));
Process background tasks inside a web application…
You can process background tasks in any OWIN-compatible application framework, including ASP.NET MVC, ASP.NET Web API, FubuMvc, Nancy, etc. Forget about AppDomain unloads, Web Garden & Web Farm issues – Hangfire is reliable for web applications from scratch, even on shared hosting.
app.UseHangfireServer();
… or anywhere else
In console applications, Windows Service, Azure Worker Role, etc.
using (new BackgroundJobServer())
{
Console.WriteLine("Hangfire Server started. Press ENTER to exit...");
Console.ReadLine();
}
Questions? Problems?
Open-source projects develop more smoothly when discussions are public.
If you have any questions, problems related to Hangfire usage or if you want to discuss new features, please visit the discussion forum. You can sign in there using your existing Google or GitHub account, so it's very simple to start using it.
If you've discovered a bug, please report it to the Hangfire GitHub Issues. Detailed reports with stack traces, actual and expected behaviours are welcome.
Related Projects
Please see the Extensions page on the official site.
Building the sources
Prerequisites:
- Razor Generator: Required if you intend to edit the cshtml files.
- Install the MSMQ service (Microsoft Message Queue Server), if not already installed.
Then, create an environment variable with Variable name Hangfire_SqlServer_ConnectionStringTemplate
and put your connection string in the Variable value field. Example:
- Variable name:
Hangfire_SqlServer_ConnectionStringTemplate
- Variable value:
Data Source=.\sqlexpress;Initial Catalog=Hangfire.SqlServer.Tests;Integrated Security=True;
To build a solution and get assembly files, just run the following command. All build artifacts, including *.pdb
files, will be placed into the build
folder. Before proposing a pull request, please use this command to ensure everything is ok. Btw, you can execute this command from the Package Manager Console window.
build
To build NuGet packages as well as an archive file, use the pack
command as shown below. You can find the result files in the build
folder.
build pack
To see the full list of available commands, pass the -docs
switch:
build -docs
Hangfire uses psake build automation tool. All psake tasks and functions defined in psake-build.ps1
(for this project) and psake-common.ps1
(for other Hangfire projects) files. Thanks to the psake project, they are very simple to use and modify!
Razor templates are compiled upon save with the Razor Generator Visual Studio extension. You will need this installed if you want to modify the Dashboard UI.
Reporting security issues
In order to give the community time to respond and upgrade we strongly urge you report all security issues privately. Please email us at security@hangfire.io with details and we will respond ASAP. Security issues always take precedence over bug fixes and feature work. We can and do mark releases as "urgent" if they contain serious security fixes.
License
Copyright © 2013-2024 Hangfire OÜ.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Legal
By submitting a Pull Request, you disavow any rights or claims to any changes submitted to the Hangfire project and assign the copyright of those changes to Hangfire OÜ.
If you cannot or do not want to reassign those rights (your employment contract for your employer may not allow this), you should not submit a PR. Open an issue and someone else can do the work.
This is a legal way of saying "If you submit a PR to us, that code becomes ours". 99.9% of the time that's what you intend anyways; we hope it doesn't scare you away from contributing.
Showing the top 20 packages that depend on Hangfire.Core.
Packages | Downloads |
---|---|
Hangfire.Console
Job console for Hangfire
|
7,074 |
Hangfire.Redis.StackExchange
Hangfire Redis Storage Based on Redis.StackExchange
See http://hangfire.io/ for some more info on the main project
|
4,417 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
2,276 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
2,205 |
Hangfire.Redis.StackExchange
Hangfire Redis Storage Based on Redis.StackExchange
See http://hangfire.io/ for some more info on the main project
|
1,728 |
Hangfire.Redis.StackExchange
Hangfire Redis Storage Based on Redis.StackExchange
See http://hangfire.io/ for some more info on the main project and https://github.com/marcoCasamento/Hangfire.Redis.StackExchange for info on this
|
1,240 |
Hangfire.NetCore
.NET Core's Worker Service host support for Hangfire (background job system for ASP.NET applications).
|
921 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
744 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
619 |
Hangfire.Console
Job console for Hangfire
|
381 |
MT.PACKAGE.UTILITY
妙探科技nuget工具包
|
258 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
202 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
194 |
MT.PACKAGE.UTILITY
妙探科技nuget工具包
1、添加日期转财务报表报告期DateTime扩展方法
|
99 |
Hangfire.NetCore
.NET Core's Worker Service host support for Hangfire (background job system for ASP.NET applications).
|
81 |
Hangfire.Redis.StackExchange
Hangfire Redis Storage Based on Redis.StackExchange
See http://hangfire.io/ for some more info on the main project
|
45 |
Abp.HangFire
Abp.HangFire
|
42 |
Hangfire.AspNetCore
ASP.NET Core support for Hangfire (background job system for ASP.NET applications).
|
36 |
Abp.HangFire
Abp.HangFire
|
33 |
Abp.HangFire
Abp.HangFire
|
32 |
.NET Framework 4.5.1
- Owin (>= 1.0.0)
- Newtonsoft.Json (>= 5.0.1)
.NET Framework 4.6
- Owin (>= 1.0.0)
- Newtonsoft.Json (>= 5.0.1)
.NET Standard 1.3
- NETStandard.Library (>= 1.6.0)
- System.Threading.Thread (>= 4.0.0)
- System.Threading.ThreadPool (>= 4.0.10)
- Newtonsoft.Json (>= 9.0.1)
.NET Standard 2.0
- Newtonsoft.Json (>= 11.0.1)
Version | Downloads | Last updated |
---|---|---|
1.8.17 | 4 | 12/11/2024 |
1.8.16 | 4 | 11/28/2024 |
1.8.15 | 5 | 10/25/2024 |
1.8.14 | 14 | 06/14/2024 |
1.8.12 | 12 | 04/11/2024 |
1.8.11 | 19 | 02/29/2024 |
1.8.10 | 63 | 02/19/2024 |
1.8.9 | 24 | 02/06/2024 |
1.8.7 | 16 | 02/11/2024 |
1.8.6 | 921 | 11/03/2023 |
1.8.5 | 18 | 08/14/2023 |
1.8.4 | 17 | 10/10/2023 |
1.8.3 | 21 | 07/01/2023 |
1.8.2 | 916 | 09/22/2023 |
1.8.1 | 19 | 06/20/2023 |
1.8.0 | 21 | 10/13/2023 |
1.8.0-rc4 | 18 | 09/30/2023 |
1.8.0-rc3 | 11 | 09/28/2023 |
1.8.0-rc2 | 16 | 07/05/2023 |
1.8.0-rc1 | 12 | 07/05/2023 |
1.8.0-beta4 | 14 | 09/28/2023 |
1.8.0-beta3 | 17 | 07/26/2023 |
1.8.0-beta2 | 18 | 07/26/2023 |
1.8.0-beta1 | 15 | 07/04/2023 |
1.7.37 | 12 | 04/13/2024 |
1.7.36 | 22 | 09/18/2023 |
1.7.35 | 18 | 10/13/2023 |
1.7.34 | 16 | 10/06/2023 |
1.7.33 | 20 | 07/04/2023 |
1.7.32 | 15 | 06/19/2023 |
1.7.31 | 20 | 10/07/2023 |
1.7.30 | 2,183 | 06/16/2022 |
1.7.29 | 15 | 06/21/2023 |
1.7.28 | 14 | 06/09/2023 |
1.7.27 | 2,231 | 11/12/2021 |
1.7.26 | 17 | 09/28/2023 |
1.7.25 | 16 | 09/29/2023 |
1.7.24 | 17 | 07/05/2023 |
1.7.23 | 16 | 10/14/2023 |
1.7.22 | 625 | 05/24/2021 |
1.7.21 | 18 | 09/28/2023 |
1.7.20 | 20 | 09/30/2023 |
1.7.19 | 194 | 03/01/2021 |
1.7.18 | 210 | 12/16/2020 |
1.7.17 | 755 | 12/16/2020 |
1.7.16 | 16 | 06/08/2023 |
1.7.15 | 16 | 10/01/2023 |
1.7.14 | 18 | 09/29/2023 |
1.7.13 | 17 | 09/18/2023 |
1.7.12 | 17 | 09/30/2023 |
1.7.11 | 3,527 | 12/16/2020 |
1.7.10 | 18 | 02/19/2022 |
1.7.9 | 18 | 10/03/2023 |
1.7.8 | 14 | 10/04/2023 |
1.7.7 | 17 | 10/07/2023 |
1.7.6 | 14 | 09/30/2023 |
1.7.5 | 14 | 10/02/2023 |
1.7.4 | 16 | 06/09/2023 |
1.7.3 | 44 | 01/18/2021 |
1.7.2 | 19 | 10/08/2023 |
1.7.1 | 20 | 07/27/2023 |
1.7.0 | 21 | 06/13/2023 |
1.6.30 | 15 | 10/22/2023 |
1.6.29 | 13 | 10/09/2023 |
1.6.28 | 16 | 10/22/2023 |
1.6.27 | 16 | 10/09/2023 |
1.6.26 | 13 | 10/23/2023 |
1.6.25 | 14 | 10/02/2023 |
1.6.24 | 14 | 10/05/2023 |
1.6.23 | 19 | 10/23/2023 |
1.6.22 | 15 | 10/22/2023 |
1.6.21 | 14 | 09/29/2023 |
1.6.20 | 13 | 10/01/2023 |
1.6.19 | 15 | 10/23/2023 |
1.6.18 | 16 | 10/19/2023 |
1.6.17 | 17 | 10/10/2023 |
1.6.16 | 19 | 09/29/2023 |
1.6.15 | 17 | 10/22/2023 |
1.6.14 | 15 | 10/23/2023 |
1.6.13 | 19 | 09/30/2023 |
1.6.12 | 16 | 10/05/2023 |
1.6.11 | 20 | 09/29/2023 |
1.6.10 | 15 | 09/29/2023 |
1.6.9 | 14 | 10/02/2023 |
1.6.8 | 14 | 10/13/2023 |
1.6.7 | 15 | 09/28/2023 |
1.6.6 | 20 | 09/29/2023 |
1.6.5 | 14 | 10/14/2023 |
1.6.4 | 18 | 10/13/2023 |
1.6.3 | 16 | 10/09/2023 |
1.6.2 | 18 | 09/29/2023 |
1.6.1 | 13 | 10/09/2023 |
1.6.0 | 6,750 | 12/16/2020 |
1.5.9 | 18 | 10/02/2023 |
1.5.8 | 24 | 10/02/2023 |
1.5.7 | 14 | 10/14/2023 |
1.5.6 | 15 | 10/06/2023 |
1.5.5 | 15 | 09/29/2023 |
1.5.4 | 17 | 09/29/2023 |
1.5.3 | 14 | 10/14/2023 |
1.5.2 | 14 | 10/13/2023 |
1.5.1 | 15 | 10/11/2023 |
1.5.0 | 23 | 10/14/2023 |
1.4.7 | 15 | 10/09/2023 |
1.4.6 | 13 | 10/09/2023 |
1.4.5 | 14 | 10/13/2023 |
1.4.4 | 14 | 10/05/2023 |
1.4.3 | 16 | 10/04/2023 |
1.4.2 | 13 | 10/14/2023 |
1.4.1 | 19 | 10/14/2023 |
1.3.4 | 17 | 10/14/2023 |
1.3.3 | 14 | 10/14/2023 |
1.3.2 | 15 | 10/14/2023 |
1.3.1 | 16 | 10/14/2023 |
1.3.0 | 19 | 10/08/2023 |
1.2.2 | 13 | 10/14/2023 |
1.2.1 | 16 | 10/13/2023 |
1.2.0 | 16 | 10/14/2023 |
1.1.1 | 17 | 10/14/2023 |
1.1.0 | 17 | 10/14/2023 |
1.0.2 | 16 | 10/14/2023 |
1.0.1 | 19 | 10/14/2023 |
1.0.0 | 17 | 10/14/2023 |
0.9.1 | 14 | 10/11/2023 |
0.9.0 | 19 | 10/09/2023 |
0.8.3 | 17 | 10/14/2023 |
0.8.2 | 15 | 10/14/2023 |
0.8.1 | 18 | 10/13/2023 |
0.8.0 | 15 | 10/06/2023 |
0.7.5 | 18 | 10/14/2023 |
0.7.4 | 15 | 10/14/2023 |
0.7.3 | 17 | 10/14/2023 |
0.7.1 | 13 | 10/11/2023 |
0.7.0 | 22 | 10/05/2023 |
0.6.2 | 18 | 10/14/2023 |
0.6.1 | 18 | 10/13/2023 |
0.5.2 | 15 | 10/14/2023 |
0.5.1 | 16 | 10/14/2023 |
0.5.0 | 13 | 10/11/2023 |