Skip to content
Development preview · 2.0.0-SNAPSHOT

TBBPM specification

Schema: TBBPM.xsd. Supported runtimes: Full JDK 17, 21, and 25 with jdk.compiler; see Supported platforms.

TBBPM is CompileFlow’s compact XML format for business workflows. A definition is parsed, validated, and prepared for compiled or interpreted execution. Choose the engine according to whether execution state must survive a restart:

  • ProcessEngine executes one invocation in the application process.
  • DurableProcessEngine persists Run state through checkpoints, including Waits, Timers, Effects, and terminal states.

This choice changes how some nodes work. Only Durable supports timerTask. In ProcessEngine, waitTask provides named entries for later, independent trigger(...) calls. In Durable, they persist a Wait that is completed with a token identifying that Wait occurrence. Effect is an Action execution mode, not a separate node. TBBPM does not provide a built-in human-task service or arbitrary BPMN message correlation.

A definition is checked in three stages:

  1. TBBPM.xsd checks XML structure and basic attribute types.
  2. The parser resolves nodes and transitions into a model.
  3. Model validation and strict preflight check graph structure, loops, actions, and compilation requirements.

Unknown elements and invalid attributes are rejected. Definitions use UTF-8; the XML encoding declaration may be omitted or must identify UTF-8. DOCTYPE declarations are not allowed. Integer execution attributes (maxIterations, maxAttempts, maxReconcileAttempts) and backoffMultiplier follow the shared numeric syntax, even with schema validation disabled.

The root element is <bpm>:

<?xml version="1.0" encoding="UTF-8"?>
<bpm code="greeting.flow" name="Greeting" description="Build a greeting">
<var name="name" dataType="java.lang.String" inOutType="param"/>
<var name="greeting" dataType="java.lang.String" inOutType="return"/>
<start id="start" name="Start" g="0,0,32,32">
<transition to="greet"/>
</start>
<scriptTask id="greet" name="Build greeting" g="80,0,120,48">
<action type="script" language="qlexpress">
<input source="name" target="name" dataType="java.lang.String"/>
<output target="greeting" dataType="java.lang.String"/>
<code>'Hello, ' + name</code>
</action>
<transition to="end"/>
</scriptTask>
<end id="end" name="End" g="240,0,32,32"/>
</bpm>

This ProcessEngine example returns greeting="Hello, Ada" when called with name="Ada". It requires the optional compileflow-script-qlexpress module, whose JAR includes the standard Extension service declaration; see Quick Start. Durable definitions must also declare each Action’s execution mode as described below.

Attribute Required Meaning
code yes Process code. Namespace, version, and alias belong to ProcessRef, not the XML.
name no Display name.
description no Human-readable description.

The root does not carry deployment version, tenant, alias, or a triggerability mode flag. A waitTask can serve as a trigger entry when it meets the restrictions in section 3.3. The XML code must exactly equal the code carried by its ProcessDefinition. Process codes are canonical identifiers of at most 128 characters: they start with an ASCII letter or digit and contain only ASCII letters, digits, ., _, or -.

<var name="orderId"
dataType="java.lang.String"
inOutType="param"
defaultValue=""
description="Order identifier"/>
Attribute Required Meaning
name yes Process-variable name; must be a valid Java identifier.
dataType yes Java type name.
inOutType yes param, return, or inner.
defaultValue no Initial value.
description no Documentation.

Variable names must be unique across param, return, and inner. A root variable’s name becomes both a generated Java field name and a process-context map key. Root variables declare state; source and target are used only in action, process-call, and Wait output mappings.

param declares caller input, return declares process output, and inner declares internal state. ProcessEngine.execute(...) and Durable Start accept any subset of declared param variables. Passing a return, inner, or undeclared key fails. An omitted parameter keeps its definition default; a supplied key with value null explicitly sets it to null.

A ProcessEngine trigger invocation may initialize any declared root variable. It starts a new invocation using that state; it does not resume a Durable Run.

Every executable or diagram node requires an id; the geometry attribute g is optional. Node IDs must be globally unique across the complete model, including nested loops. An id and each transition’s to must be non-blank, at most 512 Unicode code points, and contain no surrounding whitespace, control characters, or Unicode format characters. Identifiers are matched exactly, without trimming or normalization. name and description are optional unless specified below.

A transition is always nested in its source node:

<transition to="next" condition="amount &gt; 100" name="highValue"/>

to is required; condition, name, and g are optional. Outgoing transitions are evaluated in declaration order. TBBPM does not accept a transition priority, a root-level transition, or a from attribute. A target must resolve inside the transition’s current node container. Every executable node must be reachable from that container’s configured start; diagram-only note nodes are excluded from this reachability rule. Only outgoing transitions of exclusive or inclusive split gateways may declare condition. A non-gateway node has at most one outgoing transition, which must be unconditional; use an explicit gateway to branch.

<start id="start" name="Start" g="0,0,32,32">
<transition to="task"/>
</start>
<end id="end" name="End" g="240,0,32,32"/>

A process has exactly one start and one end. The start has exactly one outgoing transition. The end is the unique control-flow exit and has no outgoing transition.

autoTask and scriptTask each execute exactly one <action> before continuing. An autoTask calls an application Java class or host component; a scriptTask runs code included in the flow definition. A script can declare zero or more inputs and at most one output. Using a script does not require INTERPRETED process mode. Use transitions and gateways for control flow; an empty task is invalid.

<autoTask id="calculate" name="Calculate total" g="80,0,120,48">
<action type="class" execution="replayable" class="com.example.PriceCalculator" method="calculate">
<input target="price" dataType="java.math.BigDecimal" source="price"/>
<input target="quantity" dataType="java.lang.Integer" source="quantity"/>
<output dataType="java.math.BigDecimal" target="total"/>
</action>
<transition to="end"/>
</autoTask>

execution="replayable|effect" is an <action> attribute. ProcessEngine accepts omitted or replayable execution and rejects effect. Every executable Action in a Durable model must declare its execution mode. replayable runs with the flow and may run again if its state changes were not committed. The calculation in this example must therefore have no external side effects. In Durable, effect saves an Effect record before making the external call.

In ProcessEngine, an optional <invocationPolicy> governs synchronous retries and timeouts (section 6). Use it only when the implementation tolerates retries and uncertain timeout outcomes. Durable replayable Actions accept only the default effective invocation policy; omit the element. An effect Action must not declare it at all. Durable uses <effectPolicy> for Effect recovery. ProcessEngine rejects Effect Actions during preparation.

In ProcessEngine, a waitTask is a trigger entry selected by node ID, optionally qualified by an event. In Durable, reaching it saves a Wait occurrence. These two entry fragments have no deadline:

<waitTask id="approval" name="Approval" g="80,0,120,48">
<transition to="applyApproval"/>
</waitTask>
<waitTask id="payment" name="Payment"
event="payment.completed" g="80,80,120,48">
<transition to="checkPayment"/>
</waitTask>

The globally unique, non-blank node id selects the entry. An optional event qualifies it. If present, the event obeys the same nonblank, length, whitespace, and character constraints as a node ID. An omitted event does not filter the supplied event; a declared event must match exactly. The event is not a Durable completion token or subscription.

When ProcessEngine execution reaches a wait entry, that invocation ends and its execution result reports the reached entry. A synchronous Process Call cannot target a definition containing a trigger entry. A later trigger(...) starts a new execution at the matching trigger-entry node ID. Its input must contain all state needed by the remaining flow. If event is declared, the requested event must match. Wait nodes have no inAction or outAction; authors use explicit task nodes when work is required on either side.

A ProcessEngine trigger supplies all input state for a fresh invocation; the application owns prior state and event correlation. Eligible Wait entries must be in the root process, outside concurrent regions, and have no deadline, iteration wrapper, output mappings, or native outcome/time projections. With Durable, reaching the node saves a Wait record. DurableProcessEngine.completeWait(...) saves the result for that specific Wait using the token emitted with WAIT_COMMITTED. A Durable Worker then continues execution when the Run is eligible to run. Durable Wait entries may appear inside a loop; a token is valid only for the exact loop occurrence that created it.

Choose at most one deadline attribute for a Durable Wait. Omit all four for an unbounded Wait (NONE).

Business deadline Fixed value Evaluated from process state
Allow an interval from the creation of this Wait (AFTER) timeout="PT24H" timeoutExpression="approvalTimeout" returning java.time.Duration
Stop accepting replies at a specified instant (AT) deadlineAt="2026-10-18T08:00:00.123Z" deadlineAtExpression="approvalDeadline" returning java.time.Instant

For hand-written XML, run durableEngine.tooling().prepare(definition) or run preflight with the Workbench execution target set to Durable. For example, combining timeout with deadlineAt, omitting the time zone from deadlineAt, or specifying a fractional millisecond can pass TBBPM XSD validation. Durable preflight rejects each of these definitions.

Expressions follow the checked Java binding rules used by Timers. A blank expression, missing reference, wrong type, or null result fails; it does not produce an unbounded Wait. Absolute instants and relative durations require whole-millisecond precision. Relative timeouts must be non-negative and no greater than P36500D. An expression is evaluated when entering each Wait occurrence; a later loop iteration creates a new occurrence and evaluates it again.

Durable Wait deadlines and Timer wake times share the inclusive UTC scheduling range 1000-01-01T00:00:00.000Z through 9999-12-31T23:59:59.499Z. A Timer’s effective rounded threshold and a relative schedule calculated from the Store’s locked database time must also stay within this range. Ordinary business Instant values retain their declared value domain; these limits apply when a value becomes a scheduling timestamp.

An otherwise valid absolute literal outside this range is rejected during preparation with eligibility problem DURABLE_TIME_INVALID. An expression result with an invalid range, precision, or duration, or a relative schedule whose addition exceeds the range, requests normal Run failure with diagnostic code INVALID_TIME_VALUE. The Worker preserves already-consumed boundary results and follows the configured stop policy instead of repeatedly retrying the same invalid value.

An AFTER deadline is calculated once from database time in the transaction that creates the Wait. An AT deadline keeps the supplied instant, including a past instant. If the resolved deadline is at or before the issuing database time, including timeout="PT0S" or an expression returning zero, the transaction immediately commits a TIMED_OUT result without a WAIT_COMMITTED token-delivery event. Recovery reads the stored deadline and result without evaluating the expression again.

To complete an active Wait, the engine locks the Run and Wait, then reads fresh database time. If now >= due_at, the Wait times out even if the timeout scanner has not reached it. While the Run and completion record remain queryable, retrying a successful completion with the same result still succeeds after the deadline. This retry guarantee ends when the completion record is cleaned up. Pause and restart do not extend deadlines. ProcessEngine rejects all timed forms; use Durable.

In Durable, an accepted external completion or timeout ends the current Wait and continues through its single successor. Timeout does not automatically fail the Run and does not imply business success. To distinguish the two outcomes, set the optional outcomeVariable to receive a WaitOutcome enum:

  • COMPLETED: this Wait accepted an external completion. The reply may approve, reject, or report another business result. Its payload is empty only when no output mappings are declared.
  • TIMED_OUT: this Wait reached its deadline without accepting an external completion.

If one approval sets approved=true and the next iteration times out, approved is still true. The gateway checks this iteration’s approvalOutcome and routes a timeout to escalation. Only a reply reaches the task that reads approved. Declare the tasks on both branches and their subsequent merge separately:

<var name="approvalOutcome" dataType="com.alibaba.compileflow.durable.api.wait.WaitOutcome" inOutType="inner"/>
<var name="approved" dataType="java.lang.Boolean" inOutType="inner"/>
<waitTask id="approval" event="approval.responded" timeout="PT24H" outcomeVariable="approvalOutcome">
<output source="approved" target="approved"/>
<transition to="routeApproval"/>
</waitTask>
<exclusive id="routeApproval">
<transition to="escalateApproval"
condition="approvalOutcome == com.alibaba.compileflow.durable.api.wait.WaitOutcome.TIMED_OUT"/>
<transition to="applyApprovalReply"/>
</exclusive>

The target must be a declared root process variable visible at the Wait node, of exactly com.alibaba.compileflow.durable.api.wait.WaitOutcome. It follows the ordinary variable rules: param, inner, and return and declared Action outputs are allowed. Defaults use the ordinary type decoder: omitting defaultValue or leaving it empty initializes this enum variable to null. Non-empty enum defaults, including "null" or enum-name expressions, are not currently supported; use a typed param input or Action output for a non-null initial value. Use return to expose the value directly in the process result. For each resolved occurrence, the Worker overwrites the target with that occurrence’s outcome and writes any accepted business values in the same resume state update. These values survive execution-budget yields, restarts, and backend changes. A later Action can also bind the enum with source="approvalOutcome".

The variable is a result value, not the current Wait’s lifecycle state. Before the current occurrence resumes, its null, default, input, or previous value does not indicate whether this Wait is pending, completed, or timed out. Ordinary Actions may subsequently overwrite it; the value alone is not proof of an original Wait’s identity, time, or business authorization. Cancellation and Run failure use their own lifecycle contracts and do not produce a Wait outcome. A Timer waking normally is also separate; Timer nodes do not accept outcomeVariable. An unbounded Wait can produce only COMPLETED.

Omit outcomeVariable when the following work does not need a separate outcome enum. Both outcomes still take the same successor. For example, a flow may wait up to 30 seconds for a refresh notification and then always reload the authoritative business state:

<waitTask id="refreshSignal" timeout="PT30S">
<transition to="loadCurrentState"/>
</waitTask>

Flows that escalate an overdue approval or reconcile a missing payment callback should capture the outcome explicitly and use an existing exclusive gateway or Action to decide what follows. The Kernel adds no separate timeout route, implicit last-Wait variable, or business approval state.

This unbounded Wait maps the top-level callback field receipt to a process variable and records when the Store accepted the reply.

<var name="ackValue" dataType="java.lang.String" inOutType="return"/>
<var name="ackResolvedAt" dataType="java.time.Instant" inOutType="return"/>
<waitTask id="ack" resolvedAtVariable="ackResolvedAt">
<output source="receipt" target="ackValue"/>
<transition to="afterAck"/>
</waitTask>

Here completeWait(token, Map.of("receipt", "accepted")) writes ackValue, not a variable named receipt. Every declared source is required, and undeclared keys are rejected before the completion is committed. A Wait with no outputs accepts only an empty object, including a payload-free ACK. Explicit null follows the target’s ordinary type rules; it is distinct from an omitted key. Output source and target are identifiers, each must be unique within the Wait, and target must be a visible declared process variable. The type comes from the target declaration: Wait outputs do not declare dataType. Write output elements before transitions. Business outputs must not target this Wait’s outcomeVariable or resolvedAtVariable. Concurrent writes follow ordinary process-variable conflict rules. For a Wait with a deadline and business outputs but no outcomeVariable, the Workbench property panel explains that a timeout preserves previous values. The engine also logs WAIT_TIMEOUT_PRESERVES_OUTPUT during semantic preparation. The warning changes neither the preparation result, execution semantics, nor the definition fingerprint. Durable limits each Wait to 1,024 outputs and each output source to 256 Unicode code points, matching its completion API limits. The JSON-encoded completion payload also shares the default 256 KiB total byte budget. Preparation rejects a definition when the minimum possible encoding of its field names and object structure already exceeds that budget. Completion still checks the complete payload, including its business values, against the same budget.

When neither projection is needed, omit the corresponding attribute. A supplied outcomeVariable or resolvedAtVariable must be a valid nonblank variable name; an empty or whitespace-padded attribute is not equivalent to omission.

Optional resolvedAtVariable names a visible ordinary java.time.Instant variable. It receives the original database time sample used when the Store resolved the occurrence, together with the outcome and accepted business outputs in one resume update. Recovery reuses that committed value; it never substitutes worker time. This is neither the physical transaction-end timestamp nor a business decision or application-observation timestamp. On timeout it is the actual resolution time, which may be later than the deadline. A next step may use it for an ACK-relative SLA, but it does not grant current business authorization. Native time retains the Store’s precision, while Wait deadlines require whole milliseconds. To derive a later Wait deadline, use a replayable Action to calculate an ordinary java.time.Instant variable such as nextDeadline, then refer to it with deadlineAtExpression="nextDeadline". Choose the precision policy explicitly in that Action: ackResolvedAt.truncatedTo(java.time.temporal.ChronoUnit.MILLIS).plusSeconds(1800) gives a conservative cutoff up to a fraction of a millisecond earlier than an exact 30-minute interval. If the full 30 minutes are required, round the calculated deadline up to the nearest millisecond. This preserves exact milliseconds and extends other intervals by less than one millisecond. Scheduling expressions do not allow these method calls. The engine does not implicitly normalize Wait deadlines; Timer wake times follow their separate rounding rule. Omit it when the flow does not need this native time.

The Kernel stores the identity and timing needed for matching, deduplication, and recovery. WaitOutcome does not expose these facts or propagate their provenance to later Actions. Trusted process Actions may update the target through declared outputs, following the ordinary variable rules; they must not modify input-state objects in place.

ProcessEngine rejects Wait output mappings and native outcome/time projections; ordinary trigger receives its state through the invocation input. outcomeVariable, resolvedAtVariable, and output mappings participate in semantic and Durable machine fingerprints; the recovery definition identity is computed separately from the exact source bytes.

When business logic needs to correlate a request, save a distinct business request identity in an ordinary process variable before entering the Wait. Pass that identity, WaitOutcome, and business values explicitly to the next Effect. Repeating an element or identical content does not identify the same request round. A committed completion does not become a timeout because recovery happens after its deadline. TIMED_OUT carries no new business values; do not adopt values left by an earlier round. The application’s first observation or adoption time is an application fact: persist and reuse it when retry is required, and never label it as the original CF decision time. The application still decides whether new operations satisfy its current authorization, budget, and validity rules.

timerTask suspends the current Durable execution path. Database time determines when the Timer becomes eligible for processing; the due time does not guarantee that the path resumes at that instant. Other runnable branches in the same Run can continue:

<timerTask id="cooldown" name="Cooldown" duration="PT15M" g="80,0,120,48">
<transition to="charge"/>
</timerTask>

Exactly one schedule attribute is required:

Attribute Contract
duration Non-negative ISO-8601 java.time.Duration, such as PT15M.
durationExpression Deterministic expression evaluated from persisted process state; its result is a duration.
wakeAt A java.time.Instant literal, such as 2026-12-01T08:00:00.123456789Z.
wakeAtExpression Deterministic expression evaluated from persisted process state; its result is an absolute wake time.

The scheduling range and invalid-value policy above also apply to Timers. Relative Timer durations follow the same whole-millisecond, non-negative, at-most-P36500D contract as Wait timeouts.

A relative duration is anchored to the Store scheduling time. The Timer request preserves the absolute instant supplied by wakeAt or wakeAtExpression, including nanosecond precision. PostgreSQL and MySQL round the effective persisted due time up to millisecond precision, so it cannot precede the requested instant. A Timer becomes eligible for a resolution sweep when the database time reaches that effective due time; even an instant slightly earlier than scheduling may need to wait for the next millisecond. Start does not complete the Timer synchronously. The resolved time cannot precede the effective due time. Scheduling and resolution are separate database wall-clock observations; their timestamps need not be monotonic.

A Process task becomes a Durable Effect boundary through its Action:

<autoTask id="charge" name="Charge" g="240,0,120,48">
<action type="bean" execution="effect" bean="paymentAction"
class="com.example.PaymentAction" method="charge">
<input target="orderId" dataType="java.lang.String"
source="orderId"/>
<input target="effectId" dataType="java.lang.String"
metadata="effectId"/>
<output dataType="java.lang.String"
target="receiptId"/>
<effectPolicy recovery="retry"
maxAttempts="3"
recoveryDelay="PT5S"/>
</action>
<transition to="end"/>
</autoTask>

The Action still identifies the business operation, and the application runtime resolves and calls its implementation. Before dispatch, the Durable kernel saves the Effect record and the input needed for recovery. The stable Effect ID identifies this external operation. After the outcome is stored, the Worker reads it and executes the subsequent steps. Input mappings require exactly one of source, literal value, or metadata="effectId"; output mappings must target declared root process variables. The metadata name is exact and case-sensitive. An ordinary variable named effectId remains a business variable: source="effectId" reads it, while metadata="effectId" injects the engine’s identity for this Effect occurrence. The latter is valid only for Effect and reconcile inputs, never ordinary Actions or process calls.

Without <effectPolicy>, recovery uses manual: an uncertain outcome after the initial call requires operator review and is not retried automatically. Choose retry to dispatch again with the same Effect ID, or reconcile to query the external system first through reconcileAction. The query distinguishes completed, not executed, and still unknown outcomes. For retry or reconcile, map metadata="effectId" to an Action input if the business call needs a stable key; the mapping alone does not make the external operation idempotent.

The policy sets attempt limits, recovery delay, and maximum recovery duration. maxRecoveryDuration starts at unknownSince for the current uncertain outcome and is checked before another automatic dispatch or reconciliation. It does not interrupt an in-flight callback and is not a process-wide timeout. Polling, leases, and backoff while a provider is unavailable are managed by the runtime.

Choose the settings for the recovery mode:

  • manual (default): no settings are required. You may explicitly set maxAttempts="1". recoveryDelay, maxReconcileAttempts, maxRecoveryDuration, and reconcileAction are forbidden.
  • retry: require maxAttempts from 2 through 100 and a positive recoveryDelay of at most 24 hours. You may set a positive maxRecoveryDuration of at most 30 days. maxReconcileAttempts and reconcileAction are forbidden.
  • reconcile: require maxAttempts from 1 through 100, maxReconcileAttempts from 1 through 1,000, a positive recoveryDelay of at most 24 hours, and one reconcileAction. You may set a positive maxRecoveryDuration of at most 30 days.

Recovery durations use uppercase ISO-8601 notation with whole-millisecond precision.

A reconcileAction contains only an invocation and zero or more inputs. Each input declares exactly one of source or metadata="effectId", along with the required target and dataType; target names the reconcile method’s argument or script binding. source names a persisted field of the original Effect request, not a process expression. The separate metadata attribute injects the stable Effect ID. An Action input target populated from that metadata field is not itself a persisted request field. Attempt numbers are runtime telemetry and cannot be mapped into Action or reconcile business arguments. Literal value, outputs, execution settings, invocation policy, and nested Effect policy are invalid. The reconcile return value is an EffectReconcileOutcome; a confirmed result is mapped by the original Effect Action’s output declaration.

Durable preparation checks that an Effect or reconcile input mapped from metadata="effectId" accepts a Java String, including through a compatible supertype such as java.lang.CharSequence. For class and bean reconcile actions it checks the overload selected by the input targets and declared types and whether the return type can represent EffectReconcileOutcome. A method declared to return Object is checked again when invoked. The built-in Java script executor only sees JDK classes and cannot implement a reconcile action. A custom script executor receives EffectReconcileOutcome as its expected return type. The worker checks the actual reconcile outcome before applying a recovery decision.

Effects created while iterating over a collection can use different recovery limits. Set recoveryPlanVariable="variableName" to read the plan from a visible variable of type com.alibaba.compileflow.durable.api.effect.EffectRecoveryPlan. Do not also declare static recovery attributes. The machine validates the selected plan before creating the Effect, and the Store saves an immutable snapshot with that occurrence. If the plan may select RECONCILE, the policy must still declare one static reconcileAction.

Durable Wait, Timer, and Effect boundaries are valid inside supported loops. ProcessEngine rejects Timer nodes and Effect Actions and supports only the trigger-entry Wait form described in section 3.3. See the Durable Process guide for setup and execution behavior.

TBBPM supports:

  • exclusive: exclusive split or join.
  • parallel: parallel split or join.
  • inclusive: execute every matching outgoing branch.
<exclusive id="route" name="Route" g="80,0,80,48">
<transition to="premium" condition="amount &gt;= 1000"/>
<transition to="normal"/>
</exclusive>

An exclusive or inclusive split allows at most one default transition: an outgoing transition without condition. Transitions leaving a parallel gateway cannot have conditions. Each condition must have the Java type boolean or java.lang.Boolean. Only true selects a branch; false and null do not. The same rule applies to while conditions and conditional break/continue.

Conditions must have no side effects. They cannot change process variables, call services with side effects, or depend on how many times they are evaluated. Evaluation may follow model order, but it does not commit a process action.

Value-only Java expressions must be observational: Action and process-call input source expressions, gateway/loop/control conditions, and dynamic Timer or Wait deadline expressions must not change process state, reachable objects, or external systems. Preparation rejects direct assignment, compound assignment, increment, and decrement operators. Unicode escapes are translated according to Java lexical rules before literals and comments are excluded from this check; malformed escapes are rejected. Ordinary ProcessEngine expressions and input mapping expressions allow method calls. Durable control and scheduling expressions have a narrower typed allowlist. Static validation cannot prove method purity; the trusted author remains responsible for read-only, deterministic behavior. Literal value/defaultValue attributes and Action script bodies follow their own literal or execution rules.

Gateway behavior follows its type and topology; TBBPM has no next, pairing identifier, or separate fork/join node types:

  • an exclusive gateway with at least two outgoing transitions selects one path for each arriving activation; it may have one or several incoming transitions, including a combined merge and decision;
  • an exclusive merge has at least two incoming transitions and one unconditional outgoing transition. It passes through each arriving activation without synchronizing concurrent branches;
  • alternative exclusive paths may share activities and partially merge. The engine executes the selected path up to the nearest shared downstream node, then runs the shared steps once for that branch selection;
  • a parallel/inclusive split has one incoming and at least two outgoing transitions. Its matching join has at least two incoming and exactly one outgoing transition. A combined synchronizing join and split must use separate gateways;
  • concurrent branches must remain disjoint and enter only through their split. They must reach a matching join before shared later nodes, unless every branch terminates directly. Exclusive routing cannot bypass that synchronization;
  • every executable node must be reachable, each container has one control-flow exit, and invalid concurrent regions or flow across container boundaries are rejected before code generation.

A parallel join waits for the logical branches activated by its matching split. Exclusive alternatives within one branch may reach that join through different transitions, including a conditional transition from the exclusive gateway. The selected alternative completes that branch once. For the different incoming-flow rule used by BPMN parallel joins, see Process format reference.

Gateways only route and synchronize execution; they cannot contain actions. Put any computation or external operation in a task before the split or after the join, so it has its own execution, retry, idempotency, and observation behavior. A join’s only outgoing transition cannot have a condition because the join does not make a routing decision. For conditional routing after a synchronizing join, add a separate split. An exclusive merge may also make a new decision by declaring multiple outgoing transitions. Invalid actions or conditions are rejected during validation.

Actions, scripts, expressions, and called processes must not modify objects reachable from process state. State changes must use declared outputs or the update rules of explicit process constructs. Component resolvers and script providers may be invoked concurrently across branches and Process invocations; their lifecycle owner is responsible for instance isolation or thread safety. A failed branch cannot undo an external side effect. Durable actions that perform external side effects must follow the Effect recovery contract. ProcessEngine provides no persistent recovery for them; applications must handle repeated calls and uncertain outcomes.

On entry to a concurrent region, an inclusive split evaluates all conditions against the parent flow state in model order before any active branch starts. Each active branch runs on an isolated, typed branch frame. Later nodes in that branch can observe its earlier writes, while sibling branches cannot. Only after every active branch succeeds does the engine write each branch’s declared root-variable updates back to the parent flow in model order. If a branch fails, execution is cancelled, or branch submission fails, none of those updates are written back. Concurrent return mappings must target root process variables directly; nested property, collection-element, and array-element writes are rejected. This guarantee concerns merging branch state; it cannot undo database, message, or RPC side effects.

ProcessEngine branch frames copy typed field values rather than arbitrary object graphs. In either engine, branches must treat reachable objects as read-only. The analyzer rejects only cross-branch writes to the same root Process variable; a read in one branch and a declared write in another are isolated by the fork-time snapshot. Mutable lists, maps, arrays, entities, and POJOs must not be modified in place. Aggregation should use distinct branch outputs followed by a serial post-join calculation, never completion order, a shared collection, or last-write-wins.

<subBpm id="validation" name="Validation" g="80,0,220,120">
<start id="validationStart">
<transition to="validate"/>
</start>
<autoTask id="validate">
<action type="bean" bean="validationService"
class="com.example.ValidationService" method="validate"/>
<transition to="validationEnd"/>
</autoTask>
<end id="validationEnd"/>
<transition to="next"/>
</subBpm>

subBpm groups nodes in a nested scope within the current process and shares its state. It does not create a child invocation or define a separate process identity, source location, version, call-site binding, or parameter mapping. It must contain exactly one direct start and one direct end, and every direct executable child must be reachable from that start. Nested subBpm, while, and foreach are allowed.

The frontend handles this scope in the same way as BPMN subProcess. If it is inside a loop, it may contain break or continue; these apply to the nearest enclosing loop, not to the subBpm itself.

<bpmCall id="validate" name="Validate" code="order.validate"
classpath="flows/order-validate.bpm" g="80,0,120,48">
<input target="orderId" source="orderId"/>
<output source="validatedOrder" target="validatedOrder"/>
<transition to="end"/>
</bpmCall>

bpmCall invokes another BPM definition. code is required and follows the same canonical process-code rules as the root definition. Exactly one of classpath or version is required. classpath is an exact, canonical resource path from the application classpath; it is not a URI and does not support schemes, parent traversal, wildcard lookup, or caller-relative resolution. On the ProcessEngine, the called process runs synchronously. Call inputs map caller values to the called process’s param variables; outputs map its return variables back to the caller. To wait for external work after the call, connect the bpmCall to an explicit waitTask. The current ProcessEngine invocation ends at that Wait; a later trigger(...) starts a new invocation. The process call itself does not correlate external events.

A call input names the called process’s target and supplies exactly one of source or value. Its type comes from the called process’s param declaration. A call output maps a called return variable, named by source, to a declared caller variable, named by target. Call mappings never declare dataType.

A Direct definition may call an exact classpath definition or an exact Version. ProcessEngine requires the version target to be loaded locally; Durable obtains its definition from the configured DurableVersionDefinitionSource during preparation. Exact-Version definitions and published artifacts may depend only on exact Versions in the caller’s namespace. Aliases select only the root process and are not inherited by nested calls. The complete transitive graph is resolved and retained before the first business action. Execution uses these bound call sites instead of looking up a process by code again.

With Durable, a call adds a ProcessInvocation frame to the same Run; it does not create an independently addressable Run. The continuation stores exact process targets and call-site bindings for recovery, without rerouting through an Alias. A successful call writes its declared return mappings; a failed call fails the caller process. Durable permits bpmCall inside concurrent gateway scopes. Process calls inside parallel foreach iterations remain unsupported; the nested-concurrency restrictions in section 3.7 still apply.

Use while for conditional repetition and foreach to iterate over a collection. TBBPM has no generic loop node whose type is selected by an attribute. Each loop body must contain exactly one direct start and one direct end; all direct executable body nodes must be reachable from the start, and the end must not have an outgoing transition. After the loop finishes, execution follows the loop node’s own transition to the next node.

Conditional loop:

<while id="retryLoop" name="Retry"
condition="attempt &lt; maxAttempts"
maxIterations="10" index="attempt" g="80,0,180,140">
<start id="retryStart"><transition to="try"/></start>
<autoTask id="try" name="Try">
<action type="bean" bean="retryService" class="com.example.RetryService" method="tryOnce"/>
<transition to="retryEnd"/>
</autoTask>
<end id="retryEnd"/>
<transition to="end"/>
</while>

condition and the maxIterations safety bound (1..2147483647) are required. index is an optional counter starting at zero and visible only within the loop condition and body. Its name must not shadow a process variable or an enclosing loop variable. If the condition remains true after the bound is reached, execution fails instead of silently truncating the loop. The bound is a TBBPM source-language requirement, not a Durable scheduler limit.

Collection loop:

<foreach id="itemsLoop" name="Items" collection="items"
item="item" itemType="com.example.Item"
index="index" g="80,0,180,140">
<start id="itemsStart"><transition to="handle"/></start>
<autoTask id="handle" name="Handle">
<action type="bean" bean="itemService" class="com.example.ItemService" method="handle">
<input target="item" dataType="com.example.Item"
source="item"/>
</action>
<transition to="itemsEnd"/>
</autoTask>
<end id="itemsEnd"/>
<transition to="end"/>
</foreach>

collection, item, and itemType are required; index is optional. execution defaults to sequential; parallel requires Durable. The item and index names are local to the loop. They must be distinct Java identifiers and cannot shadow process variables or variables in an enclosing loop.

The collection must reference a declared process variable or a visible enclosing loop variable of type Iterable or array, and itemType must be a Java class name. For an array, its component type (boxed for primitive arrays) must be assignable to the boxed item type. If the collection has exactly one direct type argument, it must be compatible with itemType. Other declarations remain valid, with each snapshotted element checked against itemType at runtime. Parallel mode requires a java.util.List-compatible declaration so input indexes remain stable across recovery.

To collect a result from each iteration, add an output child:

<foreach id="itemsLoop" collection="items" item="item"
itemType="com.example.Item">
<output target="results" source="itemResult"/>
<start id="itemsStart"><transition to="handle"/></start>
<autoTask id="handle">
<action type="bean" bean="itemService" class="com.example.ItemService" method="handle">
<input source="item" target="item" dataType="com.example.Item"/>
<output target="itemResult" dataType="com.example.Result"/>
</action>
<transition to="itemsEnd"/>
</autoTask>
<end id="itemsEnd"/>
<transition to="end"/>
</foreach>

output must be the first direct child of foreach. Both target and source are required and must name different declared process variables. The target must be declared as java.util.List, not a concrete implementation. The result is an ordered List, with no guarantee about its implementation or mutability. The source must be an inner variable. If the target List declares a type argument, it must exactly match the source type after boxing a primitive source to its wrapper type. For example, an int source can collect into List<Integer>, but not List<Long> or List<Number>; aggregation does not widen numeric types or generic arguments. A raw output List is also valid.

Parallel aggregation follows input index, regardless of completion order. Sequential aggregation follows iteration order and writes the complete List when the loop exits, including the result of an iteration that ends with break. Before each iteration, the source variable is reset to its declared default, so an early continue cannot reuse the previous result. Empty input produces an empty output List without creating iteration work.

break and continue may appear in sequential loop bodies, with an optional condition expression. An unconditional control node must not declare an outgoing transition. A conditional control node may declare at most one normal outgoing transition. continue is also valid per iteration in parallel foreach; break is forbidden there because a single iteration cannot cancel its already-issued siblings deterministically. They may be nested through embedded subBpm scopes and always bind to the nearest enclosing loop; a nested loop therefore owns its own controls.

Sequential loops may be nested. A parallel collection loop may be nested under a sequential loop. In Durable, a parallel collection loop cannot be nested inside another parallel collection loop or a concurrent gateway scope, and its iterations cannot contain concurrent gateway splits. Structured concurrent gateways may nest inside other concurrent gateway scopes.

ProcessEngine trigger entries and Parallel/Inclusive concurrent splits are not valid loop children. Durable sequential loops may contain Wait, Timer, Effect Action, and structured Parallel/Inclusive scopes. Durable process calls are supported inside concurrent gateway scopes but remain forbidden inside parallel foreach iterations. Loop and control expressions use Java expression semantics, with Durable’s additional restrictions described in the type system.

The engine limits the number of active parallel iterations, starting more as earlier iterations finish. compileflow.durable.worker.max-active-iterations sets this limit (1..64, default 32). It is a runtime scheduling setting and does not become part of the persisted process identity. The input is fixed once, each iteration has isolated state, and its input index stays the same after recovery. Configured output aggregation follows input index rather than completion order. The continuation stores the parent state once, plus each active iteration’s changes relative to it. Empty input creates no iteration work and, when output is configured, produces an empty output collection.

note is non-executable diagram metadata and cannot participate in transitions:

<note id="note1" name="Review" comment="Manual review happens externally"
g="80,80,180,40"/>

All actions use one canonical XML shape:

<action type="class" class="com.example.Handler" method="run"/>

Supported built-in action types are:

type Attributes and children Meaning
class class, optional method (default execute), optional input/output Construct the declared class for this invocation and call its method.
bean bean, class, optional method (default execute), optional mappings Look up the named business object through the host and call its method.
script language, one code, optional mappings Run the supplied code through the selected script executor.

A class action constructs the public target class through its public no-argument constructor for each invocation. A bean action obtains its target by bean name and declared Java type through the application’s ProcessComponentResolver. Spring Boot uses the current application context by default, preserving the bean’s configured scope and proxies. The host manages the resolver and business objects. The engine creates and closes script executors and other extensions loaded from standard service declarations. See the extension guide.

script is the only protocol action type for dynamic code. Its language selects a registered ScriptExecutor. Java, QLExpress, and MVEL scripts share the same XML and input/output mapping rules; any additional language must use that contract. Exclusive gateway conditions, loop conditions, timer and Wait deadline expressions, and transition guards remain Java expressions and do not use a script executor.

Declare script inputs and outputs with <input> and <output>. In an <action>, write children in schema order: inputs, optional output, code (required for scripts), optional invocation policy, then optional Effect policy. The execution mode and action type determine which of those children are allowed. Java code contains a method body, such as return price.multiply(java.math.BigDecimal.valueOf(quantity));. During runtime loading, the built-in Java executor generates a typed wrapper and compiles it with javac --release 17. The resulting ScriptProgram belongs to that runtime and is not persisted. The immutable process version keeps the language, exact source, and declared signature so the runtime can be rebuilt.

Java code accepts only JDK platform input/output types and runs inside the application process as trusted code. It provides no sandbox. Workbench Server must not execute code from untrusted authors. Applications that accept such code need a separate execution environment outside the CompileFlow deployment, isolated by operating-system or container controls.

For the QLExpress example below, add the optional compileflow-script-qlexpress module. Its JAR includes the standard Extension service declaration; see Quick Start.

<action type="script" language="qlexpress">
<input source="price" target="price" dataType="java.math.BigDecimal"/>
<input source="quantity" target="quantity" dataType="java.lang.Integer"/>
<output target="total" dataType="java.math.BigDecimal"/>
<code>price * quantity</code>
</action>

For MVEL, add compileflow-script-mvel and set language="mvel". Its expression syntax, host-object access, and deferred compilation are described in the MVEL module guide. A registered language does not imply a sandbox.

Java script example (executor included in Core):

<action type="script" language="java">
<input source="name" target="name" dataType="java.lang.String"/>
<output target="greeting" dataType="java.lang.String"/>
<code><![CDATA[return "Hello, " + name;]]></code>
</action>

A mapping reads its declared input and writes the value to target.

An action input is <input source="processExpression" target="argument" dataType="java.lang.String"/>. target and dataType are required. Specify exactly one of source, value, or metadata. Source expressions are preserved exactly. Only an Effect Action may use metadata="effectId"; it is neither a Java expression nor a persisted business request field. Process-call inputs still allow only source or value. value is a literal parsed using the declared type; it is not a fallback for a null source. For String inputs, value="" means an empty string. Variable declarations retain defaultValue for initial values; input mappings cannot use that attribute. For every action type in ProcessEngine and Durable, source is a Java expression checked against the declared input dataType. Conversions that Java does not permit must be explicit in the expression; see Input expressions.

An explicit numeric or boolean input literal must contain a value (for example, value="0" or value="false"). Preparation rejects empty and whitespace-only literals, including for boxed types. Process-call input literals use the same rule against the resolved child parameter type.

For a class or bean action, each target must exactly match a formal parameter on the class or interface declared in class. Names are case-sensitive. Supply exactly one input per parameter. The engine evaluates inputs in XML order and passes their values by name. The following action calls send(emailAddress, messageText) even though the body mapping appears first.

<!-- Mailer.send(String to, String body) -->
<action type="bean" bean="mailer" class="com.example.Mailer" method="send">
<input target="body" source="messageText" dataType="java.lang.String"/>
<input target="to" source="emailAddress" dataType="java.lang.String"/>
</action>

Compile the module declaring the business method with javac -parameters to retain parameter names. When a bean’s declared type is an interface, its method declaration supplies the names. Preparation uses the input names and declared dataType values to select one overload. Unknown, duplicate or missing targets, unavailable parameter names, and ambiguous overloads fail preparation. Bind a varargs parameter such as String... recipients with one String[] input named recipients. Reconcile actions use the same named binding.

Scripts use target as the variable name. Effects persist ordinary request fields under their target names. A reconcile input’s source can reference these fields. Parameter names are part of the flow binding contract: renaming an exposed parameter may break preparation of existing flow versions even if the JVM method signature is unchanged. Before release, run strict preflight against the actual declared types in the target environment; for Durable, prepare the complete exact version dependency graph. Existing Durable Runs may still need the old signature, so retain that facade until no flow version or recoverable Run depends on it. Previously saved Effect requests still use the original field names.

An action output is <output target="processVariable" dataType="java.lang.String"/>. Its source is the action’s single return value and is therefore implicit. Both attributes are required, only one output may be declared, and its target must be a declared root process variable. Omitting the output discards the return value.

Process calls use the same mapping direction, with both ends named explicitly: inputs map the caller’s source to the called process’s target; outputs map the called process’s source to the caller’s target. Types come from the called process’s param and return declarations, so call mappings do not repeat dataType. Resolving the complete call graph rejects input and output conflicts that can be established from declared types, including known generic argument conflicts. Supported conversions, raw types and dynamic expressions remain available; actual values follow runtime conversion rules. Root-only preflight does not check the complete call graph.

This policy controls synchronous ProcessEngine Action calls. The example assumes an order validation method with no external side effects that is safe to retry. For Durable external operations, see the Effect recovery policy in section 3.4.

<action type="class" class="com.example.OrderService" method="validateOrder">
<invocationPolicy timeout="PT2M"
attemptTimeout="PT30S"
maxAttempts="3"
initialBackoff="PT1S"
backoffMultiplier="2.0"
maxBackoff="PT10S"
jitter="full"
retryOn="transient"
onFailure="propagate"/>
</action>

Durations use uppercase ISO-8601 notation with whole-millisecond precision. timeout is the positive time limit for the whole invocation, including every attempt and retry delay. attemptTimeout limits one attempt and must be positive; when both are set, it cannot exceed timeout. An attempt receives the smaller of its own limit and the time remaining for the invocation. maxAttempts is 1..100, including the initial call, and the backoff multiplier must be finite and at least 1.0.

When omitted, timeout and attemptTimeout impose no time limit, and the defaults are maxAttempts=1, initialBackoff=PT1S, backoffMultiplier=1.0, maxBackoff=100 * initialBackoff, jitter=full, retryOn=always, and onFailure=propagate. Backoff durations must be nonnegative, and maxBackoff must not be smaller than initialBackoff. Durations and calculated defaults must fit in a long millisecond value.

Setting maxAttempts above 1 without retryOn uses the default always. Whenever the effective policy has maxAttempts > 1 and retryOn=always (whether explicit or defaulted), semantic preparation logs ACTION_BROAD_RETRY, and Workbench displays a warning. Confirm that the operation is safe to repeat or choose an explicitly narrower policy; transient alone does not guarantee external idempotency. The warning changes neither the defaults nor execution behavior.

Input preparation failures and declared-result conversions (including unboxing and generic casts) or output mapping failures after the business method returns normally are not retried, even with retryOn="always". A timeout in either stage does not redispatch the business call. Ordinary terminal failures still follow onFailure.

Java Actions that allow automatic retry (maxAttempts > 1 and retryOn other than never), and all class/bean Effect Actions, require a typed invocation boundary that the generated caller can express. Preparation rejects a binding that can only use a direct call with inaccessible signature types, because argument unboxing or return casts cannot then be reliably separated from business execution. Expose an accessible public signature or a public facade. Ordinary and replayable Java Actions without automatic retry can still use these directly callable signatures; normal Java type checking and conversions remain in force.

onFailure="continue" allows a weak dependency to continue after a terminal failure, including actions with output mappings. Failed attempts do not write output; the target retains its prior value (for example, a preinitialized fallback recommendation). A successful null result is written according to the normal mapping rules. If downstream logic must know whether the latest query succeeded, model that business status explicitly or propagate the failure. Continuing neither asserts action success nor reverses external operations. The engine logs the terminal failure it continues past with the node ID, invocation key, attempt count, and exception type, without including application exception messages or payloads. jitter is full by default or none. Full jitter chooses each delay uniformly between zero and the current capped exponential backoff. An attempt timeout can be retried only if the attempt has stopped, the configured policy permits retry, and time and attempts remain. An overall timeout does not retry. Retry delay counts toward the overall budget; no new attempt starts after the deadline. The ordinary final failure is handled by onFailure. retryOn and onFailure use built-in policy names or names declared by policy extensions discovered by the engine. Names must match exactly and use lowercase kebab-case.

On timeout the engine requests cancellation and waits up to the configured action-timeout.cancellation-grace-period for the action to exit. If it has not stopped, execution fails with CF_EXEC_007, without another attempt or onFailure="continue". Cancellation grace and synchronous policy callbacks mean that timeout is not a hard wall-clock bound on the caller’s return. Cancellation cannot undo an external effect. Use these policies only when the action can tolerate retry and an uncertain timeout outcome. They do not provide Durable recovery or guarantee that an external operation happens exactly once. An Effect Action must not declare <invocationPolicy>, even with default values. Durable also rejects non-default invocation policies on replayable Actions. Use execution="replayable|effect"; an Effect can declare <effectPolicy> to choose its recovery behavior.

ProcessPreflightOptions.fast() resolves the exact source, parses XML, validates the schema, and checks shared model and structural semantics. It catches, among other failures:

  • Missing or duplicate node IDs and process variables.
  • Missing start/end nodes or invalid gateway shape.
  • Unresolved transitions and executable nodes unreachable from their container start.
  • Missing loop attributes, invalid iteration bounds, malformed loop scopes, and invalid break/continue placement.

ProcessPreflightOptions.strict() additionally prepares the configured ProcessEngine backend, including its capability checks, Java types, action bindings, expressions, and registered script executors. It may reuse an exact cached runtime. COMPILED generates and compiles the process Java class; INTERPRETED prepares the interpreter and may compile Java expressions or actions without generating that process class.

Target-specific limits are checked during runtime preparation. ProcessEngine enforces the Wait entry restrictions in section 3.3 and rejects Timer nodes and Effect Actions. Durable rejects concurrent splits nested inside parallel foreach; Durable sequential loops may own structured concurrent splits. Use DurableProcessEngine.tooling().prepare(...) to check Durable capabilities and prepare the complete static dependency graph. These preparation operations do not publish Versions, change routing, or execute process business actions.

Execution resolves one exact definition byte snapshot, builds a runtime identity from that content and local compilation inputs, and executes the selected runtime (COMPILED by default, or INTERPRETED over the same semantic plan). Repeated requests may reuse that exact runtime. Triggered execution uses the same source, routing, runtime, result, and observability pipeline as ProcessEngine execution.

ProcessResult<Map<String, Object>> result = engine.trigger(
ProcessDefinition.classpath(ProcessModelType.TBBPM, "payment.flow", "flows/payment.flow.bpm"),
ProcessTrigger.on("payment", "payment.completed"),
Map.of("paymentId", "P-42"));

The call starts a new invocation at payment. It does not restore a previous Java object or stored process instance.

A conforming CompileFlow TBBPM implementation:

  • Accepts only XML admitted by the bundled XSD and semantic validator.
  • Rejects unknown elements, invalid attributes, unresolved transitions, and unsupported actions.
  • Uses foreach and while as the only loop nodes, without a generic loop discriminator.
  • Accepts only the restricted ProcessEngine trigger-entry form in section 3.3; Durable Waits may occur inside supported scopes and loops.
  • Compiles generated Java with release 17.
  • Does not persist ProcessEngine invocation state; Run recovery requires DurableProcessEngine.
  • Does not provide general message correlation or an engine-native human-task lifecycle.