Skip to content

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.


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" />
Plain Task BPMN diagramPlain Task BPMN diagram

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>
Script Task BPMN diagramScript Task BPMN diagram

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>
User Task BPMN diagramUser Task BPMN diagram

A Service Task (<bpmn:serviceTask type="…">) delegates execution to a custom-task plugin identified by the type attribute. The plugin runs on a Worker silo — either bundled with the engine image or in a dedicated external plugin host — and publishes results 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-caller" />
<fleans:ioMapping>
<fleans:input source="=apiUrl" target="url" />
<fleans:output source="=__response.body" target="result" />
</fleans:ioMapping>
</bpmn:extensionElements>
</bpmn:serviceTask>
Service Task BPMN diagramService Task BPMN diagram

The type value must match a registered plugin’s TaskType. To learn more:

Source: BpmnConverter.cs#L333.


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.