Hangfire 1.8.17
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.
No packages depend on Hangfire.
.NET Framework 4.5.1
- Hangfire.Core (= 1.8.17)
- Hangfire.SqlServer (= 1.8.17)
- Microsoft.Owin.Host.SystemWeb (>= 3.0.0)
.NET Standard 1.3
- Hangfire.Core (= 1.8.17)
- Hangfire.SqlServer (= 1.8.17)
- Hangfire.AspNetCore (= 1.8.17)
.NET Standard 2.0
- Hangfire.Core (= 1.8.17)
- Hangfire.SqlServer (= 1.8.17)
- Hangfire.AspNetCore (= 1.8.17)
Version | Downloads | Last updated |
---|---|---|
1.8.17 | 1 | 26.12.2024 |
1.8.16 | 0 | 27.11.2024 |
1.8.15 | 3 | 08.12.2024 |
1.8.14 | 10 | 22.09.2024 |
1.8.12 | 0 | 03.04.2024 |
1.8.11 | 12 | 02.05.2024 |
1.8.10 | 8 | 22.09.2024 |
1.8.9 | 0 | 24.01.2024 |
1.8.7 | 11 | 02.09.2024 |
1.8.6 | 7 | 23.10.2024 |
1.8.5 | 7 | 22.09.2024 |
1.8.4 | 6 | 22.09.2024 |
1.8.3 | 6 | 22.09.2024 |
1.8.2 | 7 | 22.09.2024 |
1.8.1 | 8 | 23.10.2024 |
1.8.0 | 0 | 28.04.2023 |
1.7.37 | 5 | 29.10.2024 |
1.7.36 | 7 | 22.09.2024 |
1.7.35 | 7 | 23.10.2024 |
1.7.34 | 7 | 22.09.2024 |
1.7.33 | 9 | 22.09.2024 |
1.7.32 | 0 | 21.11.2022 |
1.7.31 | 0 | 19.08.2022 |
1.7.30 | 8 | 22.09.2024 |
1.7.29 | 8 | 22.09.2024 |
1.7.28 | 7 | 22.09.2024 |
1.7.27 | 6 | 23.10.2024 |
1.7.26 | 0 | 27.10.2021 |
1.7.25 | 0 | 30.08.2021 |
1.7.24 | 0 | 28.06.2021 |
1.7.23 | 0 | 28.05.2021 |
1.7.22 | 0 | 13.04.2021 |
1.7.21 | 0 | 12.04.2021 |
1.7.20 | 0 | 19.03.2021 |
1.7.19 | 7 | 23.10.2024 |
1.7.18 | 6 | 22.09.2024 |
1.7.17 | 8 | 22.09.2024 |
1.7.16 | 0 | 14.10.2020 |
1.7.15 | 9 | 22.09.2024 |
1.7.14 | 7 | 22.09.2024 |
1.7.13 | 0 | 15.09.2020 |
1.7.12 | 0 | 24.07.2020 |
1.7.11 | 7 | 22.09.2024 |
1.7.10 | 6 | 22.09.2024 |
1.7.9 | 7 | 22.09.2024 |
1.7.8 | 0 | 05.12.2019 |
1.7.7 | 0 | 22.10.2019 |
1.7.6 | 0 | 05.08.2019 |
1.7.5 | 8 | 22.09.2024 |
1.7.4 | 0 | 28.06.2019 |
1.7.3 | 7 | 22.09.2024 |
1.7.2 | 8 | 22.09.2024 |
1.7.1 | 10 | 22.09.2024 |
1.7.0 | 5 | 22.09.2024 |
1.6.30 | 0 | 29.04.2021 |
1.6.29 | 6 | 22.09.2024 |
1.6.28 | 0 | 14.01.2020 |
1.6.27 | 0 | 27.06.2019 |
1.6.26 | 0 | 23.05.2019 |
1.6.25 | 0 | 09.04.2019 |
1.6.24 | 6 | 23.10.2024 |
1.6.23 | 0 | 13.03.2019 |
1.6.22 | 5 | 22.09.2024 |
1.6.21 | 0 | 01.11.2018 |
1.6.20 | 1 | 22.12.2024 |
1.6.19 | 5 | 22.09.2024 |
1.6.18 | 8 | 22.09.2024 |
1.6.17 | 0 | 19.09.2017 |
1.6.16 | 7 | 23.10.2024 |
1.6.15 | 0 | 08.08.2017 |
1.6.14 | 8 | 22.09.2024 |
1.6.13 | 0 | 07.06.2017 |
1.6.12 | 0 | 22.03.2017 |
1.6.11 | 8 | 22.09.2024 |
1.6.10 | 0 | 13.03.2017 |
1.6.9 | 0 | 02.03.2017 |
1.6.8 | 0 | 21.12.2016 |
1.6.7 | 0 | 25.11.2016 |
1.6.6 | 0 | 13.10.2016 |
1.6.5 | 9 | 22.09.2024 |
1.6.4 | 5 | 22.09.2024 |
1.6.3 | 6 | 22.09.2024 |
1.6.2 | 6 | 22.09.2024 |
1.6.1 | 0 | 27.07.2016 |
1.6.0 | 0 | 15.07.2016 |
1.5.9 | 0 | 11.07.2016 |
1.5.8 | 0 | 17.06.2016 |
1.5.7 | 0 | 30.05.2016 |
1.5.6 | 0 | 22.04.2016 |
1.5.5 | 8 | 22.09.2024 |
1.5.4 | 7 | 22.09.2024 |
1.5.3 | 0 | 06.11.2015 |
1.5.2 | 8 | 22.09.2024 |
1.5.1 | 5 | 22.09.2024 |
1.5.0 | 0 | 01.10.2015 |
1.4.7 | 6 | 22.09.2024 |
1.4.6 | 5 | 22.09.2024 |
1.4.5 | 8 | 22.09.2024 |
1.4.4 | 7 | 22.09.2024 |
1.4.3 | 0 | 27.05.2015 |
1.4.2 | 0 | 06.05.2015 |
1.4.1 | 7 | 23.10.2024 |
1.3.4 | 6 | 22.09.2024 |
1.3.3 | 0 | 28.01.2015 |
1.3.2 | 9 | 22.09.2024 |
1.3.1 | 0 | 13.01.2015 |
1.3.0 | 0 | 10.12.2014 |
1.2.2 | 5 | 29.10.2024 |
1.2.1 | 12 | 22.09.2024 |
1.2.0 | 8 | 23.10.2024 |
1.1.1 | 0 | 05.09.2014 |
1.1.0 | 0 | 03.09.2014 |
1.0.2 | 7 | 22.09.2024 |
1.0.1 | 0 | 30.06.2014 |
1.0.0 | 0 | 30.06.2014 |
0.9.1 | 0 | 12.06.2014 |
0.9.0 | 9 | 22.09.2024 |
0.8.3 | 0 | 23.05.2014 |
0.8.2 | 5 | 29.10.2024 |
0.8.1 | 6 | 22.09.2024 |
0.8.0 | 7 | 23.10.2024 |
0.7.5 | 9 | 22.09.2024 |
0.7.4 | 0 | 07.04.2014 |
0.7.3 | 3 | 10.12.2024 |
0.7.2 | 6 | 22.09.2024 |
0.7.1 | 7 | 22.09.2024 |
0.7.0 | 7 | 22.09.2024 |
0.6.2 | 9 | 22.09.2024 |
0.6.1 | 7 | 22.09.2024 |
0.6.0 | 0 | 27.01.2014 |
0.5.2 | 0 | 19.11.2013 |
0.5.1 | 0 | 12.11.2013 |
0.5.0 | 6 | 22.09.2024 |