Add then to the Java DSL#1190
Conversation
ricardozanini
left a comment
There was a problem hiding this comment.
Great work! Have you also checked how the mermaid diagram handles it? It's tangential to this work, but I can't remember whether I implemented it there.
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/Step.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR adds .then(...) chaining support to the experimental Java functional fluent DSL steps, allowing a task to direct workflow execution to a named next task (or a flow directive like END) without requiring Consumer.andThen() composition. This addresses issue #1188 by improving DSL ergonomics and adds tests to validate both model generation and runtime behavior.
Changes:
- Add
then(String taskName)andthen(FlowDirectiveEnum directive)to the fluentStepDSL sofunction(...)/consume(...)steps can set the task’sthendirective. - Extend DSL unit tests to assert the generated workflow model contains the expected
thenFlowDirective. - Add an integration-style test in
impl/testto validate runtime execution jumps/stops based onthen(...).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/Step.java |
Adds then(...) chaining APIs that defer to TaskBaseBuilder.then(...) via queued post-configurers. |
experimental/fluent/func/src/test/java/io/serverlessworkflow/fluent/func/FuncDSLTest.java |
Adds unit tests verifying then(...) is serialized into the underlying task model for both function(...) and consume(...). |
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java |
Adds runtime tests asserting .then("task") skips the next task and .then(END) stops execution. |
impl/test/pom.xml |
Adds test-scope dependencies needed to build/execute workflows created with the experimental fluent func DSL and Java lambda execution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
fjtirado
left a comment
There was a problem hiding this comment.
I think the test needs to changed
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
impl/test/src/test/java/io/serverlessworkflow/impl/test/WorkflowThenTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Changes
This pull request allows us to jump to a task using
then(String taskName):Closes #1188