Tasks
Tasks are the atomic units of work in a Fleans workflow. Each task maps to a <bpmn:*Task> element
and runs exactly once per activation. Fleans supports four task variants; a fifth (Send Task) is not
yet implemented — see Send Task below.
See also: BPMN Support matrix for the full coverage table.
Plain Task
Section titled “Plain Task”A Plain Task (<bpmn:task>) completes immediately with no executor — the engine advances to
the next element as soon as activation is recorded. Use it for modelling a human activity or a
placeholder that will be replaced later.
BPMN:
<bpmn:task id="Task_1" name="Do something" />Script Task
Section titled “Script Task”A Script Task (<bpmn:scriptTask scriptFormat="csharp">) executes a C# expression via
DynamicExpresso. The expression string is
read from <camunda:script> and evaluated against a _context variable bag that exposes the
current workflow variables.
BPMN:
<bpmn:scriptTask id="Task_1" name="Compute total" scriptFormat="csharp"> <bpmn:extensionElements> <camunda:script><![CDATA[_context.total = _context.price * _context.qty]]></camunda:script> </bpmn:extensionElements></bpmn:scriptTask>User Task
Section titled “User Task”A User Task (<bpmn:userTask>) suspends the workflow and waits for a human to act. Fleans
exposes a claim → complete (or fail / cancel) lifecycle via REST and the admin UI.
BPMN:
<!-- Requires xmlns:fleans="https://fleans.io/schema/bpmn/1.0" on <bpmn:definitions> --><bpmn:userTask id="Task_1" name="Approve request"> <bpmn:extensionElements> <fleans:assignmentDefinition assignee="manager" candidateGroups="approvers" /> </bpmn:extensionElements></bpmn:userTask>Service Task (Custom Task)
Section titled “Service Task (Custom Task)”A Service Task (<bpmn:serviceTask type="…">) delegates execution to a handler
identified by the type attribute. It runs on a worker connected over gRPC —
your own, or the ready-made plugins’ image; the engine images bundle none —
and its result comes back through <fleans:output> bindings.
BPMN:
<!-- Requires xmlns:fleans="https://fleans.io/schema/bpmn/1.0" on <bpmn:definitions> --><bpmn:serviceTask id="Task_1" name="Call external API"> <bpmn:extensionElements> <fleans:taskDefinition type="rest-call" /> <fleans:ioMapping> <fleans:input source="=apiUrl" target="url" /> <fleans:output source="=__response.body" target="result" /> </fleans:ioMapping> </bpmn:extensionElements></bpmn:serviceTask>The type value must match the task type a worker registers — rest-call above is the REST Caller
plugin from fleans-plugins. To learn more:
- Custom Tasks — architecture, event flow, parameter mapping, and the ready-made plugins.
- Input/Output Mapping — the
<fleans:ioMapping>expression syntax, shared by every task type. - Hosting workers — run workers next to the engine.
- Writing custom tasks — step-by-step authoring guide.
Source: BpmnConverter.cs#L333.
Input/output mapping
Section titled “Input/output mapping”Every task type accepts <fleans:ioMapping>: inputs compute task-local variables from C#
expressions before the task runs, and outputs pick what it hands back to the process. See
Input/Output Mapping.
Send Task
Section titled “Send Task”Send Task (<bpmn:sendTask>) is not yet implemented in Fleans. If a BPMN file contains a
Send Task, the converter will not recognise it and the element will be skipped or cause a parse
error. A dedicated fixture and implementation are tracked in issue #420-E.