Releases: HangfireIO/Hangfire
0.7
Release Notes
Dear 0.7-alpha users! Please, DROP ALL HangFire tables before using this release!
- #43 – Changed NuGet package structure.
- #33 – Persistent storage abstraction.
- #34 – SQL Server job storage implementation.
- #41 – Using Common.Logging for logging and Json.NET for json encoding.
- #39 – Improved job fetching implementation.
- #47 – Increased default worker count.
- #35 – Removed obsolete
Perform
class. Please, see how to update your old jobs. - #44 – Fixed empty MVC 5 project Internal Server Error.
- #45 – Short exception stack traces, they contain only your code.
- #46 – Apply the Failed state when state filters/handlers cause an exception.
- Started work on restoration of the broken tests.
- Clarified some type names, state subsystem was greatly simplified.
Upgrading Guide
NuGet package structure has been changed. SQL Server job storage implementation now installed by default with the HangFire package. If you are using Redis as a storage and don't want to change anything, please, do the following steps:
Uninstall-Package HangFire
Uninstall-Package HangFire.Core
Install-Package HangFire.Redis
Install-Package HangFire.Web
- Update your HangFireConfig.cs file as described below.
- If your jobs are still based on the BackgroundJob class, upgrade them.
public static void Start()
{
// Place this line in the top of the Start method.
JobStorage.Current = new RedisStorage("localhost:6379", 0);
// ...
var server = /* ... */
0.6.2
0.6
What's new?
New Client API
Brand new Client API, based on lambda expressions. With this change, you don't even need to define custom job classes. You are able to invoke your existing methods asynchronously while maintaining persistence and transparency.
Two types of methods are supported: static and instance. Static methods will be simply called on the server side (without instance activation). To call instance methods, server will create an instance of the method's class first using the JobActivator
class.
public class CommentController : Controller
{
/* Other actions */
public ActionResult PostComment(string text)
{
var id = CommentService.Create(User, text);
// Static method
BackgroundJob.Enqueue(() => CheckForSpam(id));
// Instance method
BackgroundJob.Enqueue<CommentController>(x => x.SendToModerator(id));
return RedirectToAction(/* Some action */);
}
[NonAction]
public void SendToModerator(int commentId)
{
/* Implementation logic */
}
public static void CheckForSpam(int commentId)
{
/* Implementation logic (Akismet, etc.) */
}
}
Breaking changes
- Lifecycle of the
JobActivator
class has been changed. Use theJobActivator.SetCurrent
method to change it. - The signature of the
JobActivator.ActivateJob
method was changed. It now returns an instance ofobject
instead of an instance of theBackgroundJob
class. - The
JobDescriptor
class was removed. You can see all its properties in the*Context
classes. - The signature of all filter interfaces was changed. Affected
IStateChangingFilter
,IStateChangedFilter
,IClientFilter
,IServerFilter
. - The signature of
JobState
methods was changed also.
You'll need to change a bit your JobActivator
-based and JobFilterAttribute
-based classes.
Transition to the new API
The structure of those jobs, that were created with the new API, was changed. Since new API is more flexible, the old one will be deleted to not to confuse new users with several methods of doing the same things. This version does not contain breaking changes related to the Client API, but it was made obsolete and its usage is prohibited.
To make sure that the storage does not contain jobs in the old format, the transition to the new API will be implemented in two stages.
v0.7
: Remove thePerform
class to prohibit the use of the Old Client API. After removal of thePerform
class, you'll need to convert your existing job classes to correspond to the new API. If your storage is still contains old jobs, they will be processed anyway.Before v1.0
: Remove theBackgroundJob.Perform
method. All old jobs will be failed during their processing. You'll need to ensure that all old jobs were processing before proceeding to the version 1.0.
0.5
This is the first public release. Please, see the Getting Started guide.