Skip to content

Workers ​

A worker is a process that runs your jobs and workflow steps. The server hands out the work and shows it; workers do it. This section is for the people who deploy and run them; Develop is how to write the code inside.

A worker is your own program, in Python, TypeScript, Ruby, Go, Rust, Java, PHP, .NET or Elixir, with the JoobQ SDK in it. It reaches the server over HTTPS with one token, and never holds the Redis credentials, the payload keys or the licence.

Drawing the diagram…

Workers and producers talk only to the server. Nothing connects to a worker.

Queue workers and workflow workers ​

A worker does one or both of two kinds of work, depending on what it registers. They behave differently when something fails, so know which you are running.

Drawing the diagram…

A job is one trip through a queue. A workflow run is a loop: the server's engine hands out one step at a time and decides what follows from each result.

Queue workerWorkflow worker Pro
RegistersJobsWorkflows (their blueprints and step handlers)
RunsA job: one handler, start to finishOne step of a workflow run at a time
Who decides what comes nextNobody: a job is done when its handler returnsThe workflow engine inside the server: the next step, a retry, a wait, a compensation
Listens onThe queues of its jobsThe task queue of its workflows (workflows unless the blueprint names another)
Where the state isThe job itself, in its queueThe run's history, kept by the server. A worker holds none of it
A failureRetried with backoff while the job has retries left (3 by default), then a dead letterRetried only if the step declares retries. When a step fails for good, the compensations of the completed steps run, newest first, and the run ends failed
The worker dies in the middleThe job runs again, with one retry usedThe step runs again only if it declares retries. Finished steps are never run again
No worker is aliveJobs wait in their queueRuns wait at their current step, until a step's or the run's timeout
NeedsNothing beyond the SDK tokenA JoobQ Pro key on the server: without one, registering a workflow answers 402 pro_required
Watch it onQueues, Jobs, Dead lettersWorkflows

Both are the same program and the same deployment: a worker that registers jobs is a queue worker, one that registers workflows is a workflow worker, and one that registers both is both. They share its concurrency.

Run them as separate processes when their needs differ. Typical reasons:

  • A backlog of bulk jobs should not take the slots that workflow steps wait for.
  • They scale on different signals: queue size for jobs, steps waiting for workflows.
  • You want to pause or cap one without the other. Pause, concurrency and throttle apply per queue, and a task queue is a queue: give workflows a task queue of their own name.

How to write each is in Jobs and Durable workflows.

Find your page ​

What to know first ​

  • Delivery is at least once. A worker that dies, or is cut off, has its tasks run again. Handlers must be safe to run twice: see Best practices.
  • A worker stops cleanly on SIGTERM: no new work, finish what is running, report, exit.
  • It shows on the console's Workers page while it is alive.
  • A lapsed licence does not stop it. The SDK gateway keeps serving; Pro features follow the Pro key (Licence and Pro key).
The console's Workers page: one card per worker node with its team, service, process id, version, uptime, fibers in use, CPU, memory and queues.The console's Workers page: one card per worker node with its team, service, process id, version, uptime, fibers in use, CPU, memory and queues.
The Workers page: every registered worker and what it serves (mock data).