Hangfire.Console.Extensions 2.1.0
Hangfire.Console.Extensions
Features
- Makes it easier to use
Hangfire.Consolewith .net core dependency injection
Setup
In .NET Core's Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire((serviceProvider, configuration) => configuration
.UseConsole()
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseMemoryStorage());
services.AddHangfireConsoleExtensions();
services.AddHangfireServer();
}
Starting a job
To start a job you can use the IJobManager, it will automatically check if you are currently inside a job, if that is the case it will mark the started job as a Continuation.
Log
Instead of logging using the extension method on PerformContext you can now just use the ILogging and it will get logged to both normal logging facilities and Hangfire.Console.
Progressbar
To create a progress bar you can use IProgressBarFactory.
IJobCancellationToken
Just take the IJobCancellationToken as a constructor parameter to get a hold of the cancellation token.
Schedule jobs
Contains a extension method for AddOrUpdateManuallyTriggered if you have a job that should only be run manually.
Hangfire.Console.Extensions.Serilog
Usage with Serilog.Settings.Configuration
Add WithHangfireContext to Enrich and add Hangfire as a WriteTo target
Example:
"Serilog": {
"Enrich": [ "WithHangfireContext" ],
"WriteTo": [
{
"Name": "Hangfire",
"Args": {
"restrictedToMinimumLevel": "Information"
}
}
]
}
Showing the top 20 packages that depend on Hangfire.Console.Extensions.
| Packages | Downloads |
|---|---|
|
Hangfire.Console.Extensions.Serilog
Makes it easier to use Hangfire.Console with serilog
|
1 |
|
Hangfire.Console.Extensions.Serilog
Makes it easier to use Hangfire.Console with serilog
|
7 |
|
Hangfire.Console.Extensions.Serilog
Makes it easier to use Hangfire.Console with serilog
|
8 |
|
Hangfire.Console.Extensions.Serilog
Makes it easier to use Hangfire.Console with serilog
|
9 |
|
Hangfire.Console.Extensions.Serilog
Makes it easier to use Hangfire.Console with serilog
|
10 |
|
Hangfire.Console.Extensions.Serilog
Makes it easier to use Hangfire.Console with serilog
|
14 |
.NET Standard 2.1
- IdentityStream.Hangfire.Console (>= 2.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 7.0.0)