How-to

Run a long-running process

BPMN is the picture-language for a process that does not finish in one message: decisions, waits, deadlines, and calls out to integrations. Sirius reads the XML and runs it.

A typical first process: a request arrives, a threshold decides auto-approve versus manager review, a timer escalates if nobody answers, and a service task submits the work to an existing integration.

Before you start

Open BPMN. Read the Operational readiness banner.

  • Green means the engine is wired.
  • Details lists licensed, process/instance stores, the service-task binder, and (advisory) the timer scheduler.
  • Amber on a blocking item is 501 not_configured waiting to happen. Share that line with the administrator.

1. Import

You do not have to draw first. Load starter fills a sample process. Preview parses the XML and shows the diagram — nothing is saved. Import & save stores it.

Malformed XML fails here with a validation error, not later at runtime.

2. Simulate

Simulation answers “which path would this take?” without calling a real integration.

{ "amount": 200 }

Small amounts take the auto-approve branch. Raise the amount and simulate again — the path should go through review.

3. Bind a service task

A service task has a sirius:component attribute. Point it at a component id you already run:

<serviceTask id="submit-order" name="Submit order"
             sirius:component="warehouse-http" />

Re-import. Then Run:

  • Design mode — sandbox transforms, skip destinations. Dress rehearsal.
  • Async mode — enqueue destinations for real.

Simulate to check routing. Design mode to check wiring. Async when you mean it.

4. Wait for the real world

A durable instance is a running copy saved to the database. It survives restarts while it waits.

  1. Start an instance with inputs that take the review branch.
  2. Status shows waiting (for example message: manager-approval).
  3. Deliver the message from the message panel — or POST /bpmn/instances/{id}/message. The instance resumes.
  4. To test the deadline instead, wait. A boundary timer takes the escalation path when the scheduler fires.
curl -s -X POST "$SIRIUS/bpmn/processes/import" \
  -H 'content-type: application/json' \
  -d '{"tenant_id":"default","xml":"…","save":true}'

curl -s -X POST "$SIRIUS/bpmn/processes/<id>/execute" \
  -H 'content-type: application/json' \
  -d '{"tenant_id":"default","variables":{"amount":200}}'

curl -s -X POST "$SIRIUS/bpmn/processes/<id>/run" \
  -H 'content-type: application/json' \
  -d '{"tenant_id":"default","mode":"design","variables":{"amount":200}}'

curl -s -X POST "$SIRIUS/bpmn/processes/<id>/instances" \
  -H 'content-type: application/json' \
  -d '{"tenant_id":"default","variables":{"amount":5000}}'

curl -s "$SIRIUS/bpmn/instances?tenant_id=default"
curl -s -X POST "$SIRIUS/bpmn/instances/<instance>/message" \
  -H 'content-type: application/json' \
  -d '{"message":"manager-approval"}'

Instance lists page with next_cursor in the body (ceiling 500).

What is supported

Start/end events; service tasks bound to components; exclusive, parallel, and inclusive gateways; durable waits (timer, message, signal, condition); boundary events; event subprocesses; multi-instance; compensation; call activities; broadcast messages and signals.

There is no drag-and-drop editor (you import XML) and no built-in human task inbox yet. userTask is parsed; it has no worklist UI. Durable waits inside a called child run to completion synchronously.

The agent can answer “are any instances stuck waiting?” with the same readiness and instance routes.