Expose dynamic background worker scheduler capabilities#25397
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a provider-reported capability surface to IDynamicBackgroundWorkerManager so consumers (e.g., LowCode Designer) can determine whether cron scheduling and runtime registration are supported without relying on provider type names.
Changes:
- Introduces
DynamicBackgroundWorkerManagerCapabilitiesand exposes it viaIDynamicBackgroundWorkerManager.Capabilities. - Sets provider-specific capability values for Default, Hangfire, Quartz, and TickerQ dynamic worker managers.
- Makes the default in-memory dynamic worker manager reject
CronExpressionand adds tests for capability reporting + cron rejection.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundWorkers/DynamicBackgroundWorkerManager_Tests.cs | Adds tests for capability reporting and cron rejection in the default manager. |
| framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/IDynamicBackgroundWorkerManager.cs | Exposes provider capabilities via a new Capabilities property on the public interface. |
| framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/DynamicBackgroundWorkerManagerCapabilities.cs | Adds a new capabilities DTO describing cron + dynamic registration support. |
| framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/DefaultDynamicBackgroundWorkerManager.cs | Reports capabilities and rejects schedules containing CronExpression. |
| framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/TickerQDynamicBackgroundWorkerManager.cs | Reports TickerQ’s dynamic manager capability values. |
| framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo/Abp/BackgroundWorkers/Quartz/QuartzDynamicBackgroundWorkerManager.cs | Reports Quartz dynamic manager capability values (defaults to supported). |
| framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo/Abp/BackgroundWorkers/Hangfire/HangfireDynamicBackgroundWorkerManager.cs | Reports Hangfire dynamic manager capability values (defaults to supported). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #25397 +/- ##
==========================================
- Coverage 49.31% 49.29% -0.02%
==========================================
Files 3667 3667
Lines 123177 123177
Branches 9409 9409
==========================================
- Hits 60741 60717 -24
- Misses 60627 60652 +25
+ Partials 1809 1808 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I think using an interface to indicate the capabilities of background workers is more in line with the current framework's design style(similar to public interface ISupportsCronScheduling
{
}
public interface ISupportsRuntimeRegistration
{
}
public class DefaultDynamicBackgroundWorkerManager :
IDynamicBackgroundWorkerManager,
ISupportsRuntimeRegistration,
ISingletonDependency
{
// ...
}
public class HangfireDynamicBackgroundWorkerManager :
IDynamicBackgroundWorkerManager,
ISupportsRuntimeRegistration,
ISupportsCronScheduling,
ISingletonDependency
{
// ...
}
public class QuartzDynamicBackgroundWorkerManager :
IDynamicBackgroundWorkerManager,
ISupportsRuntimeRegistration,
ISupportsCronScheduling,
ISingletonDependency
{
// ...
}
public class TickerQDynamicBackgroundWorkerManager :
IDynamicBackgroundWorkerManager,
ISingletonDependency
{
// implements neither marker
} |
…WorkerManager and add test for exception on UpdateSchedule with CronExpression
Adds
ISupportsCronSchedulingandISupportsRuntimeRegistrationmarker interfaces so consumers can detect which scheduling features the activeIDynamicBackgroundWorkerManagersupports.ISupportsRuntimeRegistrationonly —CronExpressionis now rejected on bothAddAsyncandUpdateScheduleAsyncwith a clearer error message.