Finally after 4 months of development and after 4 betas, Hangfire 1.5.0 released. Now you are able to customize your background processing pipeline even more, by using many types that were internal in previous versions. More responsive dashboard, IoC container scopes, support for remote MSMQ queues and other cool features are waiting for you!
Release Notes
Some previous blog posts related to 1.5.0 beta releases already covered most of new features, so here are some links. I’ve updated code snippets in those blog posts to be compatible with the final release of 1.5.0 version.
- Background Processes
- IoC Container Scopes
- Instant Re-Queue with SQL Server
- Support for CancellationToken Type
- Queues for Recurring Jobs
- Support for Remote Queues in MSMQ
- New Options for Background Job Server
- Custom Background Processing Servers
- Filters for Processing State
Faster Dashboard with SQL Server
Totally forgot to mention in beta releases that Dashboard UI became dramatically faster than in previous versions, especially when you have a huge amount of background jobs (millions or so). The load time of many pages decreased in an order of magnitude, from ~800 ms to ~60 ms with the same data.
Support for Custom Schemas in SQL Server
Finally Hangfire supports custom schema names for tables and other database objects related to Hangfire. By default, it is still HangFire
(yep, the casing is old for compatibility reasons), but you can change it to dbo
or any other, using the options:
GlobalConfiguration.Configuration.UseSqlServerStorage(
"connection_string",
new SqlServerOptions { SchemaName = "dbo" });
No More Dancing with Server Names
Server Ids are not automatically generated. You don’t have to pick unique names for them, when using multiple instances of Hangfire Server in the same process.
Upgrading
If you turned off automatic migration of SQL Server job storage, here is the big yellow alert for you:
Database Schema Updated
SQL Server database schema was updated. If you disabled automatic migrations, please re-run the migration script manually before using Hangfire.
Nothing Changed Except Low-Level Types
In this release, I’ve refactored a lot of internal types, and some public types that relate to really-low-level types like IStateMachine
, IJobCreationProcess
and so. Although this may break some projects at compile time, the refactoring ended up with much cleaner design. Hope you forgive me.
Obsolete Members
However, if you don’t digged into the internals too much, you’ll face only with obsolete members:
-
BackgroundJobServerOptions.ServerName
– isn’t required anymore. -
SqlServerStorageOptions.InvisibilityTimeout
– doesn’t make sense anymore. -
BackgroundJobServerOptions.ServerWatchdogOptions
– please use newServerTimeout
andServerCheckInterval
properties instead. -
CreateJobFailedException
– replaced withBackgroundJobClientException
(derived from the former). -
Job.Arguments
– please useJob.Args
property instead. -
Job.Perform
– please use theBackgroundJobPerformer
class instead.
For Beta Users
If you used 1.5.0 betas, you may receive some compile time errors. Please see 1.5.0-beta4 release on GitHub to learn what’s changed.
Contributors
Many contributors helped to make this release by implementing new features, reviewing changes, fixing bugs and cleaning up the code. Andrew Young, Atif Aziz, Eric, @maleet, Mark Avenius, Pascal Berger, Rob van der Linden Vooren, Ryan Wright, Tom Kelly, thank you so much for your help!
Special thanks to Andrew Young and Nikola Irinchev for their hard work on the discussion forum. They helped a huge number of other users to solve their problems!
Roadmap
What’s next? Good question. Here is a quick overview of upcoming changes:
Hangfire 1.x
- Increase performance of recurring jobs
- Increase performance of delayed jobs
- Built-in support for ASP.NET 5
- Support for .NET Core platform
- Capture
Console.Write
from background jobs - More flexibility for recurring jobs
- Add functional tests for each storage
Hangfire 2.0
- Asynchronous processing for background jobs and processes
- Support for async storage methods
- Allow to use results of a parent job in continuations
Documentation
- Full API documentation for each version
- Better User’s Guide with more topics and examples