QuartzVsHangfire: Quartz.NET 4.1.0 and Hangfire 1.8.25 - #2220
Merged
vladimir-pecanac-main merged 1 commit intoSep 17, 2026
Merged
vladimir-pecanac-main merged 1 commit into
vladimir-pecanac-main merged 1 commit into
Conversation
Quartz.NET 4 closes the two gaps this comparison was scored on, so the sample now shows both: the retry policy that lives on the trigger, and the first-party Quartz.Dashboard package. - Quartz 3.19.1 to 4.1.0, and Quartz.Extensions.Hosting dropped (4.1.0 is an empty forwarding package; AddQuartzHostedService is in Quartz now). - Hangfire.Core and Hangfire.NetCore 1.8.24 to 1.8.25. - Newtonsoft.Json pinned to 13.0.4: the transitive 11.0.1 raises NU1903. - IJob.Execute and every IJobListener member move to ValueTask plus a CancellationToken. - StdSchedulerFactory and the NameValueCollection property bag are gone, so the standalone scheduler is built with QuartzSchedulerBuilder. - QuartzRetryJob drops the manual refire workaround; QuartzRetryPolicyScheduler carries the explicit and exponential retry policies instead. - QuartzDashboardSetup registers the dashboard and the execution history. dotnet build -c Release: 0 warnings, 0 errors. dotnet test: 17 of 17 passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the
dotnet-client-libraries/QuartzVsHangfiresample to Quartz.NET 4.1.0 and Hangfire 1.8.25, for the refreshed "Hangfire vs Quartz.NET: Which Scheduler to Choose?" article.Quartz.NET 4 closed the two gaps the article's verdict was scored on, so the sample now demonstrates both rather than the workarounds around them.
Packages
QuartzQuartz.Extensions.HostingAddQuartzHostedServiceis inQuartz)Quartz.DashboardHangfire.Core,Hangfire.NetCoreNewtonsoft.JsonThe
Newtonsoft.Jsonpin is not cosmetic:Hangfire.Core1.8.25 still depends onNewtonsoft.Json >= 11.0.1, which raisesNU1903(known high severity advisory). The pin is the reason the build reports 0 warnings.FrameworkReference Include="Microsoft.AspNetCore.App"is required becauseQuartz.Dashboardcarries that framework reference in its own nuspec; without it the restore fails.Code
IJob.Executeand everyIJobListenermember move toValueTaskplus aCancellationToken(BackgroundJob,ReportJob,QuartzRetryJob,LoggingJobListener).BackgroundJobreads its optional flag withTryGetBoolean: on 4.xGetBooleanthrowsInvalidCastExceptionfor a missing key where 3.x threwKeyNotFoundException.QuartzStorageConfigdropsStdSchedulerFactoryand theNameValueCollectionproperty bag, both removed in 4.x, forQuartzSchedulerBuilder.QuartzStartupuses the configurator overload ofAddJob<T>; theJobKeyoverload no longer compiles (CS1503).QuartzRetryJobloses the manual refire workaround. NewQuartzRetryPolicySchedulerputs the retry schedule on the trigger withRetryPolicy.ExplicitandRetryPolicy.Exponential.QuartzDashboardSetupregistersAddQuartzDashboardandAddQuartzExecutionHistoryand maps the dashboard.HangfireMonitoring, and the comments inLoggingJobListener/QuartzStorageConfigthat this change rewrites anyway).Tests
Tests/QuartzRetryJobTests.csis renamed toTests/QuartzRetryPolicySchedulerTests.csand rewritten, because the behaviour it asserted is the workaround this change removes.Tests/QuartzDashboardSetupTests.csis new.Verified on SDK 10.0.302, runtime
Microsoft.NETCore.App10.0.10:dotnet build QuartzVsHangfire.sln -c Release: 0 Warning(s), 0 Error(s)dotnet test QuartzVsHangfire.sln -c Release --no-build: Passed! Failed: 0, Passed: 17, Skipped: 0, Total: 17 (up from 15)dotnet run --project QuartzVsHangfire -c Release: both sample lines print as beforeThis supersedes #2190, which touched three comment lines in this same folder.