Skip to content

Add Fluent DSL Equivalents for Try/Catch/Retry Workflows#1459

Open
matheusandre1 wants to merge 1 commit into
serverlessworkflow:mainfrom
matheusandre1:issue1436
Open

Add Fluent DSL Equivalents for Try/Catch/Retry Workflows#1459
matheusandre1 wants to merge 1 commit into
serverlessworkflow:mainfrom
matheusandre1:issue1436

Conversation

@matheusandre1

Copy link
Copy Markdown
Contributor

Closes: #1436

@matheusandre1 matheusandre1 marked this pull request as ready for review June 13, 2026 21:00
@matheusandre1 matheusandre1 requested a review from fjtirado as a code owner June 13, 2026 21:00
Copilot AI review requested due to automatic review settings June 13, 2026 21:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 from try/catch.
  • Extend tryCatch() DSL with as(...) and retry(reference) plus new retry delay/backoff helpers.
  • Add HTTP redirect(boolean) to the call HTTP DSL and broaden TryCatchDslTest coverage.

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;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

here too

Signed-off-by: Matheus André <matheusandr2@gmail.com>
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 Fluent DSL Equivalents for Try/Catch/Retry Workflows

2 participants