Hangfire Pro v2.2.1 and Hangfire Pro Redis v2.5.5 Retail

Hangfire Pro v2.2.1 and Hangfire Pro Redis v2.5.5 Retail

jw6eUfe.png

Hangfire Pro is a set of extension packages that boost the performance and simplify the maintenance of background job processing in large applications. Hangfire Pro packages are available under paid subscriptions. After purchase, you receive binaries and access to the private repository on GitHub.

Packages:
Hangfire.Pro
Atomic Background Job Creation

Batches allow you to create a bunch of background jobs atomically. This means that if there was an exception during the creation of background jobs, none of them will be processed. Consider you want to send 1000 emails to your clients, and they really want to receive these emails. Here is the old way:

for (var i = 0; i < 1000; i++)
{
BackgroundJob.Enqueue(() => SendEmail(i));
// What to do on exception?
}

BatchJob.StartNew(x =>
{
for (var i = 0; i < 1000; i++)
{
x.Enqueue(() => SendEmail(i));
}
});
In case of exception, you may show an error to a user, and simply ask to retry her action after some minutes. No other code required!

Chaining Batches

Continuations allow you to chain multiple batches together. They will be executed once all background jobs of a parent batch finished. Consider the previous example where you have 1000 emails to send. If you want to make final action after sending, just add a continuation:

var id1 = BatchJob.StartNew(/* for (var i = 0; i < 1000... */);
var id2 = BatchJob.ContinueWith(id1, x =>
{
x.Enqueue(() => MarkCampaignFinished());
x.Enqueue(() => NotifyAdministrator());
});
So batches and batch continuations allow you to define workflows and configure what actions will be executed in parallel. This is very useful for heavy computational methods as they can be distributed to different machines.

Complex Workflows

Create action does not restrict you to create jobs only in Enqueued state. You can schedule jobs to execute later, add continuations, add continuations to continuations, etc..

var batchId = BatchJob.StartNew(x =>
{
x.Enqueue(() => Console.Write("1a... "));
var id1 = x.Schedule(() => Console.Write("1b... "), TimeSpan.FromSeconds(1));
var id2 = x.ContinueWith(id1, () => Console.Write("2... "));
x.ContinueWith(id2, () => Console.Write("3... "));
});

BatchJob.ContinueWith(batchId, x =>
{
x.Enqueue(() => Console.WriteLine("4..."));
});

Hangfire.Pro.Redis

Hangfire Pro comes with Hangfire.Pro.Redis package that uses Redis server to persist background jobs and other data.

Redis is well known for its outstanding performance and here are the results of relative comparison between Hangfire.SqlServer and Hangfire.Redis storages.

Hangfire.Pro.PerformanceCounters

Hangfire.Pro.PerformanceCounters package allows Hangfire to publish its internal metrics to Windows Performance Counters – the standard way to monitor Windows applications and services.

So, you can use existing tools like Nagios, New Relic, Server Density and others to proactively monitor the health of your services.

32.1 MB
rar archive

Download Link:
https://www.uploadship.com/ff4e1f4a751589de


Sign In or Register to comment.