Package com.tnsai.coordination.workflow
Class ConditionalWorkflow
java.lang.Object
com.tnsai.coordination.workflow.ConditionalWorkflow
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
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ConditionalWorkflow.Builderbuilder()execute(WorkflowContext context) Executes the conditional workflow.
-
Method Details
-
execute
Executes the conditional workflow. -
builder
-