Add Fluent DSL Equivalents for Try/Catch/Retry Workflows#1459
Open
matheusandre1 wants to merge 1 commit into
Open
Add Fluent DSL Equivalents for Try/Catch/Retry Workflows#1459matheusandre1 wants to merge 1 commit into
matheusandre1 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds DSL support for richer try/catch configuration (error variables and retry references), reusable retry policies via use { retries { ... } }, and HTTP redirect configuration, with expanded unit tests to validate the new fluent API.
Changes:
- Add
use().retries(...)support for reusable retry policies and allow referencing them fromtry/catch. - Extend
tryCatch()DSL withas(...)andretry(reference)plus new retry delay/backoff helpers. - Add HTTP
redirect(boolean)to the call HTTP DSL and broadenTryCatchDslTestcoverage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/dsl/TryCatchDslTest.java | Adds tests covering new try/catch options, retry reference usage, and HTTP redirect. |
| fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/UseSpec.java | Exposes UseSpec.retries(...) in the DSL. |
| fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/TryCatchSpec.java | Adds as(...) and retry(reference) for catch configuration. |
| fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/RetrySpec.java | Adds delay overloads and convenience backoff helpers. |
| fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/dsl/BaseCallHttpSpec.java | Adds HTTP redirect(boolean) fluent option. |
| fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/UseBuilder.java | Implements use.retries building/merging and a retries builder. |
| fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/BaseTryTaskBuilder.java | Adds retry-by-reference on try/catch catch builder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+74
to
+83
| public UseBuilder retries(Consumer<UseRetriesBuilder> retriesConsumer) { | ||
| final UseRetriesBuilder retriesBuilder = new UseRetriesBuilder(); | ||
| retriesConsumer.accept(retriesBuilder); | ||
| final UseRetries built = retriesBuilder.build(); | ||
| if (this.use.getRetries() == null) { | ||
| this.use.setRetries(new UseRetries()); | ||
| } | ||
| this.use.getRetries().getAdditionalProperties().putAll(built.getAdditionalProperties()); | ||
| return this; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
the map is never null when instantiated by UsesRetries
Comment on lines
+164
to
+168
| public UseRetries build() { | ||
| final UseRetries useRetries = new UseRetries(); | ||
| useRetries.getAdditionalProperties().putAll(this.retries); | ||
| return useRetries; | ||
| } |
Signed-off-by: Matheus André <matheusandr2@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #1436