Skip to content

fix #1251 - Add timers and scheduler to the DSL#1274

Merged
fjtirado merged 2 commits intoserverlessworkflow:mainfrom
ricardozanini:issue-1251
Mar 27, 2026
Merged

fix #1251 - Add timers and scheduler to the DSL#1274
fjtirado merged 2 commits intoserverlessworkflow:mainfrom
ricardozanini:issue-1251

Conversation

@ricardozanini
Copy link
Copy Markdown
Member

Fixes #1251

Implements spec-compliant Timeouts and Schedules, and refactors FuncDSL using a Facade pattern to delegate shared configurations to the base DSL, providing a unified developer experience.

Key Changes

  • Timeouts & Schedules: Added TimeoutBuilder and ScheduleBuilder with fluent shortcuts (timeoutMinutes, every, cron, after, on). Includes strict spec validation to prevent inline/expression collisions and enforce mutually exclusive schedule triggers.

  • DSL Unification: Extracted duplicated methods (Timeouts, Schedules, Auth, Event Strategies) from FuncDSL and replaced them with Facade delegates to spec.dsl.DSL. Users can now rely exclusively on import static FuncDSL.* without IDE import conflicts.

  • Testing: Added DSLTimeoutTest, ScheduleBuilderTest, DSLScheduleTest, and FuncDSLScheduleTest to validate low-level builder guardrails and high-level workflow integrations.

Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
@ricardozanini ricardozanini requested a review from fjtirado as a code owner March 26, 2026 18:57
Copilot AI review requested due to automatic review settings March 26, 2026 18:57
@ricardozanini ricardozanini requested a review from mcruzdev March 26, 2026 19:00
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 spec-compliant timeout + schedule configuration to the fluent DSL (spec + experimental func), including new builders and facade methods, plus tests covering builder guardrails and workflow integration.

Changes:

  • Introduces TimeoutBuilder and ScheduleBuilder and exposes fluent shortcuts via fluent.spec.dsl.DSL.
  • Adds workflow/task-level .timeout(...) and workflow-level .schedule(...) support in the fluent builders.
  • Adds unit/integration tests for timeouts/schedules and wires equivalent facades into FuncDSL, plus a small Maven module name tweak.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
impl/persistence/pom.xml Renames Maven module display name for consistency.
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/DSL.java Adds DSL shortcut methods for timeouts, schedules, and schedule event strategies.
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/TimeoutBuilder.java New builder for timeout duration (inline vs string).
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/ScheduleBuilder.java New builder enforcing mutually-exclusive schedule triggers and duration configuration.
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/BaseWorkflowBuilder.java Adds workflow-level timeout(...) and schedule(...).
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/TaskBaseBuilder.java Adds task-level timeout(...).
fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/dsl/DSLTimeoutTest.java Adds tests for workflow/task timeout configuration + validation.
fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/dsl/DSLScheduleTest.java Adds tests for workflow schedule configuration via DSL shortcuts.
fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/ScheduleBuilderTest.java Adds tests for ScheduleBuilder validation and mapping.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/FuncDSL.java Adds facade delegates to base DSL (timeouts/schedules/strategies + auth/use).
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/Step.java Adds task-level timeout hooks to func DSL steps.
experimental/fluent/func/src/test/java/io/serverlessworkflow/fluent/func/FuncDSLScheduleTest.java Adds tests validating schedule chaining via func workflow builder.

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

@ricardozanini
Copy link
Copy Markdown
Member Author

Comments from co-pilot are not relevant.

@fjtirado fjtirado merged commit 566abd3 into serverlessworkflow:main Mar 27, 2026
7 checks passed
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.

Add proper DSL schedule support "on" at workflow base and timeouts on tasks

3 participants