Skip to content

Make Quartz.NET Jobs Resilient#104

Merged
sfmskywalker merged 27 commits intomainfrom
enh/102
Dec 29, 2025
Merged

Make Quartz.NET Jobs Resilient#104
sfmskywalker merged 27 commits intomainfrom
enh/102

Conversation

@sfmskywalker
Copy link
Member

Updates Elsa to version 3.7.0-preview.4150 and refactors transient exception handling using the shared resilience module.

  • Updates package versions to 3.7.0-preview.4150.
  • Adds Elsa.Resilience.Core package reference.
  • Removes database-specific transient exception detectors.
  • Migrates Quartz module to use the shared resilience module for transient exception detection.
  • Adds unit and component tests for the Quartz scheduling module, focusing on retry behavior.

Include default and database-specific exception detectors (MySQL, PostgreSQL, SQLite, SQL Server). Introduce rescheduling logic for transient failures and register related configurations.
Include tests for transient exception detection and integrate solution structure updates.
Migrated transient exception detection logic from scheduling module to a new shared resilience module. Updated services, jobs, and features to utilize the centralized `ITransientExceptionDetectionService`. This change improves maintainability and promotes reusability across modules.
Copilot AI review requested due to automatic review settings December 24, 2025 19:56
Copy link
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

This pull request enhances the Quartz.NET scheduling module by adding resilience capabilities for handling transient exceptions. It updates Elsa to version 3.7.0-preview.4150 and integrates the shared resilience module to detect and handle transient failures in scheduled jobs.

Key Changes

  • Integrated Elsa.Resilience.Core module for transient exception detection in Quartz jobs
  • Added configurable retry mechanism with delay options (QuartzJobOptions)
  • Enhanced RunWorkflowJob and ResumeWorkflowJob with transient exception handling and automatic rescheduling
  • Added comprehensive unit and component tests for retry behavior

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/modules/scheduling/Elsa.Scheduling.Quartz/Jobs/RunWorkflowJob.cs Added transient exception detection and automatic job rescheduling on transient failures
src/modules/scheduling/Elsa.Scheduling.Quartz/Jobs/ResumeWorkflowJob.cs Added transient exception handling with retry logic and error logging
src/modules/scheduling/Elsa.Scheduling.Quartz/Features/QuartzSchedulerFeature.cs Added configuration method for QuartzJobOptions
src/modules/scheduling/Elsa.Scheduling.Quartz/Options/QuartzJobOptions.cs New options class for configuring transient retry delay
src/modules/scheduling/Elsa.Scheduling.Quartz/Extensions/QuartzJobExtensions.cs New extension method for rescheduling jobs after transient failures
test/modules/scheduling/Elsa.Scheduling.Quartz.UnitTests/* Comprehensive unit tests for job execution scenarios including transient and non-transient exception handling
test/modules/scheduling/Elsa.Scheduling.Quartz.ComponentTests/* Component tests validating retry behavior and exception detection
Directory.Build.props Updated Elsa version to 3.7.0-preview.4150
Directory.Packages.props Added Elsa.Resilience.Core package reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sfmskywalker and others added 12 commits December 24, 2025 21:08
…tion and rename related methods and properties
…try logic instead of `IOptions<QuartzJobOptions>`.
… logic instead of `IOptions<QuartzJobOptions>`.
…ameterize transient exception retry scenarios.
…eption scenarios; replace `IOptions<QuartzJobOptions>` with `IQuartzJobRetryScheduler` mock.
…ions<QuartzJobOptions>` with `IQuartzJobRetryScheduler` mock; update job initialization and workflow starter setup.
…add unit tests for retry scheduling logic.
Copy link
Contributor

Copilot AI commented Dec 24, 2025

@sfmskywalker I've opened a new pull request, #105, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Dec 24, 2025

@sfmskywalker I've opened a new pull request, #106, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot AI and others added 4 commits December 24, 2025 20:39
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…ests

The test now explicitly separates two scenarios:
- Transient exceptions: test Execute() directly without scheduling
- Non-transient exceptions: schedule job to verify deletion behavior

This clarifies that we're testing the job Execute logic directly with test doubles,
while only scheduling when needed to verify scheduler interactions.

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Fix resource leak in AppComponentTest by disposing service scope
Refactor QuartzJobTransientRetryTests to use manual job instances consistently
@sfmskywalker sfmskywalker merged commit 1e6f287 into main Dec 29, 2025
10 checks passed
@sfmskywalker sfmskywalker deleted the enh/102 branch December 29, 2025 18:54
@greptile-apps greptile-apps bot mentioned this pull request Mar 5, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants