Add Hangfire periodic worker adapter options.#24669
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the Hangfire background worker integration by introducing configurable options for the periodic background worker adapter. The changes enable dependency injection resolution of the adapter (replacing Activator.CreateInstance) and allow global configuration of timezone and queue settings through the new AbpHangfirePeriodicBackgroundWorkerAdapterOptions class.
Changes:
- Added
AbpHangfirePeriodicBackgroundWorkerAdapterOptionsclass to configure timezone and queue settings globally - Modified
HangfirePeriodicBackgroundWorkerAdapterto accept options via constructor injection - Updated
HangfireBackgroundWorkerManagerto resolve adapters via DI instead of reflection-based instantiation - Added demo application showcasing the new configuration pattern
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/AbpHangfirePeriodicBackgroundWorkerAdapterOptions.cs |
New options class for configuring timezone and queue defaults |
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfirePeriodicBackgroundWorkerAdapter.cs |
Modified to accept IOptions<AbpHangfirePeriodicBackgroundWorkerAdapterOptions> via constructor and use collection expressions |
framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireBackgroundWorkerManager.cs |
Updated to resolve adapter via DI, improved error logging, refactored variable naming, and code style improvements |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/DemoAppHangfireModule.cs |
Added demonstration of new options configuration pattern with timezone and queue settings |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/TestWorker.cs |
New test worker to demonstrate periodic background worker usage |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj |
Added project references for background workers and SQL client |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Migrations/20260119064307_Initial.cs |
New EF Core migration with future timestamp (regenerated migration) |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Migrations/20260119064307_Initial.Designer.cs |
Migration designer file with future timestamp |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Migrations/DemoAppDbContextModelSnapshot.cs |
Updated model snapshot reflecting EF Core version upgrade |
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Migrations/20201013055401_Initial.cs |
Removed old migration file |
Comments suppressed due to low confidence (1)
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Migrations/20260119064307_Initial.Designer.cs:16
- The migration attribute references a timestamp from the future (20260119 = January 19, 2026). Migration timestamps should reflect the actual date when the migration was created. This should be updated to match the correct current date and also match the filename.
...ire/Volo/Abp/BackgroundWorkers/Hangfire/AbpHangfirePeriodicBackgroundWorkerAdapterOptions.cs
Outdated
Show resolved
Hide resolved
…kgroundWorkers/Hangfire/AbpHangfirePeriodicBackgroundWorkerAdapterOptions.cs Co-authored-by: Copilot <[email protected]>
…ueProperty Handle Hangfire storage without JobQueueProperty feature.
EngincanV
approved these changes
Jan 20, 2026
4 tasks
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.
#24666