Class ConditionalWorkflow

java.lang.Object
com.tnsai.coordination.workflow.ConditionalWorkflow

public final class ConditionalWorkflow extends Object
Workflow executor with conditional branching and loop support.

Extends the basic workflow model with if/else branching and bounded loops, while reusing existing WorkflowStep, WorkflowContext, and WorkflowResult infrastructure.

Usage


 WorkflowResult result = ConditionalWorkflow.builder()
     .step("validate", validateAgent)
     .branch("validate",
         Branch.when(ctx -> "true".equals(ctx.get("valid")))
               .then("process", processAgent),
         Branch.otherwise()
               .then("reject", rejectAgent))
     .step("notify", notifyAgent, List.of("process", "reject"))
     .loop("retry", retryAgent,
         LoopCondition.whileTrue(3, ctx -> !"done".equals(ctx.get("status"))))
     .build()
     .execute(new WorkflowContext("flow-1"));
 
Since:
0.0.5