From 04a72cab4580a4df84debb58123bc767eb27e0b1 Mon Sep 17 00:00:00 2001 From: tanmaykadam1533 Date: Thu, 9 Apr 2026 19:20:10 +0530 Subject: [PATCH] docs: add Java example for invoking subflows --- .../ROOT/pages/quarkus-flow-cookbook.adoc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/modules/ROOT/pages/quarkus-flow-cookbook.adoc b/docs/modules/ROOT/pages/quarkus-flow-cookbook.adoc index 8238bfc07..35f5d0ffb 100644 --- a/docs/modules/ROOT/pages/quarkus-flow-cookbook.adoc +++ b/docs/modules/ROOT/pages/quarkus-flow-cookbook.adoc @@ -338,6 +338,10 @@ do: == 11. Invoking Subflows To keep your definitions clean and modular, complex logic can be broken down into smaller, reusable workflows using the `run` directive. +[tabs] +==== +YAML:: ++ [source,yaml] ---- document: @@ -356,6 +360,22 @@ do: customer: .user ---- +Java:: ++ +[source,java] +---- +import io.serverlessworkflow.api.fluent.FuncWorkflowBuilder; + +var workflow = FuncWorkflowBuilder.newWorkflow("run-subflow") + .startWith( + step("registerCustomer") + .runWorkflow("test", "register-customer", "0.1.0") + .input("customer", from(".user")) + ) + .build(); +---- +==== + == 12. Business Logic Error Handling (`try` / `catch`) While transient infrastructure errors are handled by Quarkus Flow's built-in Fault Tolerance, the workflow DSL's `try` and `catch` constructs are specifically designed for compensatory business logic.