Skip to content

docs: add Java example for invoking subflows#432

Open
tanmaykadam1533 wants to merge 1 commit intoquarkiverse:mainfrom
tanmaykadam1533:docs/java-subflow-428
Open

docs: add Java example for invoking subflows#432
tanmaykadam1533 wants to merge 1 commit intoquarkiverse:mainfrom
tanmaykadam1533:docs/java-subflow-428

Conversation

@tanmaykadam1533
Copy link
Copy Markdown

Description

Adds a Java DSL example for the "Invoking Subflows" section in the cookbook.

Previously, this section only included a YAML example. This PR converts it into a tabbed format (YAML + Java) and adds a corresponding Java DSL implementation using FuncWorkflowBuilder.

Fixes #428

Changes

  • Converted Section 11 (Invoking Subflows) to tabbed format
  • Added Java DSL example alongside existing YAML
  • Kept YAML unchanged for consistency

Testing

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated (if applicable)
  • Tested manually

Manual Testing

  • Verified the documentation renders correctly
  • Confirmed tabbed format (YAML + Java) is consistent with other sections

Checklist

Before submitting this PR, please ensure:

  • I ran the full build with integration tests locally
  • Code follows the project's code conventions
  • Tests have been added/updated to cover the changes
  • Documentation has been updated (if user-facing changes)
  • Commit messages are clear and follow conventional commits style
  • I have read and followed the Contributing Guide
  • I have read and comply with the LLM Usage Policy (if applicable)

Additional Notes

This change improves developer experience by providing a Java DSL equivalent for subflow invocation.

@tanmaykadam1533 tanmaykadam1533 requested a review from a team as a code owner April 9, 2026 14:05
@tanmaykadam1533
Copy link
Copy Markdown
Author

Hi maintainers 👋

This PR adds a Java DSL example for the "Invoking Subflows" section by converting the existing YAML example into a tabbed format (YAML + Java).

The change is documentation-only and follows the existing format used in other sections.

Please let me know if any changes are needed. Thanks!

@ricardozanini
Copy link
Copy Markdown
Member

Hi @tanmaykadam1533, many thanks for your contribution!

You actually made a good point with this PR by adding a Java DSL example with the YAML version on the same doc. @domhanak is currently working on the Java DSL part here: #393.

Having said that, I'd like to hear from others about the possibility of having the Java and YAML DSL on the same page rather on separated one.

I found it very useful to see both implementations together, so users can understand the slight difference between one and the other.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

😭 Deploy PR Preview failed.

@fjtirado
Copy link
Copy Markdown
Contributor

fjtirado commented Apr 9, 2026

Hi @tanmaykadam1533, many thanks for your contribution!

You actually made a good point with this PR by adding a Java DSL example with the YAML version on the same doc. @domhanak is currently working on the Java DSL part here: #393.

Having said that, I'd like to hear from others about the possibility of having the Java and YAML DSL on the same page rather on separated one.

I found it very useful to see both implementations together, so users can understand the slight difference between one and the other.

@domhanak @ricardozanini I do not know till which point we are duplicating test already present in the SDK. Maybe we should add Fluent DSL counterparts to the YAMLs being tested here.

See my comment here

@tanmaykadam1533
Copy link
Copy Markdown
Author

Thanks for the feedback!

I agree that having both Java and YAML DSL together improves understanding.
Happy to adjust the PR based on the direction decided for #393.

Please let me know if I should modify this PR or align it with the other work.

@ricardozanini
Copy link
Copy Markdown
Member

Hi @tanmaykadam1533, many thanks for your contribution!
You actually made a good point with this PR by adding a Java DSL example with the YAML version on the same doc. @domhanak is currently working on the Java DSL part here: #393.
Having said that, I'd like to hear from others about the possibility of having the Java and YAML DSL on the same page rather on separated one.
I found it very useful to see both implementations together, so users can understand the slight difference between one and the other.

@domhanak @ricardozanini I do not know till which point we are duplicating test already present in the SDK. Maybe we should add Fluent DSL counterparts to the YAMLs being tested here.

See my comment here

The idea is to run the workflows on the Quarkus Flow context. The examples from the cookbook come from the official specification repository.

@ricardozanini
Copy link
Copy Markdown
Member

Thanks for the feedback!

I agree that having both Java and YAML DSL together improves understanding. Happy to adjust the PR based on the direction decided for #393.

Please let me know if I should modify this PR or align it with the other work.

Don't need to do anything now. Since @domhanak is coordinating the Java DSL testing/docs I'd like to hear from him first which approach he'd like to take.

@cvgaviao
Copy link
Copy Markdown

cvgaviao commented Apr 9, 2026

Hello all, thanks for the quick PR.

But I got lost here. The FuncWorkflowBuilder that I have here do not have newWorkflow() method :D

What am I missing?

@ricardozanini
Copy link
Copy Markdown
Member

Hello all, thanks for the quick PR.

But I got lost here. The FuncWorkflowBuilder that I have here do not have newWorkflow() method :D

What am I missing?

I haven't reviewed this yet. Actually, we are missing this shortcut in the FuncDSL class. We only have it in DSL:

  public static TasksConfigurer workflow(WorkflowConfigurer configurer) {
    return list -> list.workflow(configurer);
  }

It should work for the FuncWorkflowBuilder too, actually.

@tanmaykadam1533, have you tested the example you added to the docs? We don't have a runWorkflow method, indeed.

@ricardozanini
Copy link
Copy Markdown
Member

Created: serverlessworkflow/sdk-java#1295

@tanmaykadam1533
Copy link
Copy Markdown
Author

Thanks for the feedback! I'll check the sdk-java#1295 issue
and update the PR once the correct method is available.
Should I wait for the SDK fix first, or use the low-level
DSL approach in the meantime?

@domhanak
Copy link
Copy Markdown
Contributor

Feel free to add this here, I can consolidate it into the Java cookbook I am working on in my PR when added. I wanted to avoid having everything in one huge doc, but we can for sure merge it if there is preference to do so.

@ricardozanini
Copy link
Copy Markdown
Member

@domhanak your preference is to split Java DSL from YAML one?

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.

docs: Add documentation on how to use sub-workflows with Java.

5 participants