An order processing system uses nested sub-workflows for fraud checking and payment processing. The main workflow calls a fraud check sub-workflow, which itself may call other sub-workflows, demonstrating multi-level workflow composition.
nest_check_fraud ──> nest_charge ──> nest_fulfill
CheckFraudWorker (nest_check_fraud) -- reads email and amount. Checks fraud indicators and returns the assessment.
ChargeWorker (nest_charge) -- reads the amount. Charges the customer and returns the charge confirmation.
FulfillWorker (nest_fulfill) -- reads the orderId. Fulfills the order and returns the fulfillment status.
nest_check_fraud: retryCount=2, retryLogic=FIXED, retryDelaySeconds=?, timeoutSeconds=60, responseTimeoutSeconds=30nest_charge: retryCount=2, retryLogic=FIXED, retryDelaySeconds=?, timeoutSeconds=60, responseTimeoutSeconds=30nest_fulfill: retryCount=2, retryLogic=FIXED, retryDelaySeconds=?, timeoutSeconds=60, responseTimeoutSeconds=30
These settings are declared in task-defs.json and apply independently to each task, controlling retry behavior, timeout detection, and backoff strategy without any changes to worker code.
This example contains 3 worker implementations in src/main/java/*/workers/, the workflow definition in src/main/resources/workflow.json, and integration tests in src/test/. The workflow ? defines 0 tasks with input parameters none and a timeout of ? seconds.
Workers are implemented as standard Conductor Worker interface implementations. Each worker reads input from task.getInputData(), performs its logic, and writes results to result.getOutputData(). All workers return TaskResult.Status.COMPLETED on success.
7 tests verify fraud checking, payment charging, order fulfillment, and correct sub-workflow nesting and data passing.
See RUNNING.md for setup and execution instructions.