Skip to content

Expose dynamic background worker scheduler capabilities#25397

Merged
maliming merged 3 commits into
devfrom
salihozkara/dynamic-worker-capabilities
May 11, 2026
Merged

Expose dynamic background worker scheduler capabilities#25397
maliming merged 3 commits into
devfrom
salihozkara/dynamic-worker-capabilities

Conversation

@salihozkara
Copy link
Copy Markdown
Member

@salihozkara salihozkara commented May 8, 2026

Adds ISupportsCronScheduling and ISupportsRuntimeRegistration marker interfaces so consumers can detect which scheduling features the active IDynamicBackgroundWorkerManager supports.

  • Hangfire and Quartz managers implement both markers.
  • Default in-memory manager implements ISupportsRuntimeRegistration only — CronExpression is now rejected on both AddAsync and UpdateScheduleAsync with a clearer error message.
  • TickerQ manager implements neither, since its dynamic API is not supported at runtime.

@salihozkara salihozkara requested review from Copilot and maliming May 8, 2026 11:42
@salihozkara salihozkara added this to the 10.5-preview milestone May 8, 2026
@salihozkara salihozkara marked this pull request as ready for review May 8, 2026 11:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DynamicBackgroundWorkerManagerCapabilities and exposes it via IDynamicBackgroundWorkerManager.Capabilities.
  • Sets provider-specific capability values for Default, Hangfire, Quartz, and TickerQ dynamic worker managers.
  • Makes the default in-memory dynamic worker manager reject CronExpression and 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
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.29%. Comparing base (7ababca) to head (44df939).
⚠️ Report is 70 commits behind head on dev.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maliming
Copy link
Copy Markdown
Member

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 IMultiTenant, ISoftDelete, etc.), What do you think?

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
}

salihozkara and others added 2 commits May 11, 2026 06:51
@maliming maliming merged commit 966c387 into dev May 11, 2026
2 checks passed
@maliming maliming deleted the salihozkara/dynamic-worker-capabilities branch May 11, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants