Nano BPM Advanced Research Prototype Write and run job workers

Write and run job workers

A worker is the code that performs a process's service tasks. The Workers tab lets you author them in TypeScript right in the browser and run them as sandboxed Deno subprocesses, with a live fleet view (status, throughput, completed/failed, uptime, restarts) and streamed logs.

Running workers needs Deno installed on the host (the deno binary on PATH, or pointed to by NANOBPMN_DENO_BIN). Without it you can still author and export worker code; only starting a worker is unavailable. Install Deno from https://deno.com.

A worker is a directory with a worker.ts that declares a handler:

import { defineWorker } from "@nanobpm/worker";

defineWorker({
  type: "my-job",
  maxParallelJobs: 10,
  async handle(job) {
    // job.variables holds the activated job's variables.
    return { result: 42 };        // resolves -> completes the job with { result: 42 }
    // or: job.fail("boom") / job.error("CODE", "msg")
  },
});

A 90s IDE, on purpose

The worker editor is deliberately styled after the integrated development environments of the early-to-mid 1990s — Borland Delphi, Microsoft Visual Basic — where the wiring was invisible and you focused only on what can't be automatically connected. The BPMN model is the form; the engine binds tasks to workers by job type; the transport, retries, timeouts, and dependency resolution are handled for you. You write only the handler body. That ethos drives the editor's code intelligence: