Skip to content
NewJoobQ SDKs updated to v0.8.0.Build your first workflow

Ten languages

Workers in the language your service is written in.

Crystal jobs and workflows run natively on the JoobQ shards. Python, TypeScript, Ruby, Go, Rust, Java, PHP, .NET and Elixir workers use thin SDKs that talk to the SDK gateway of a self-hosted JoobQUI (/api/v1/sdk) with the server’s SDK token: they long-poll for tasks, renew their leases and complete or fail them with a stack trace, and never connect to Redis. Jobs are Core; SDK workflows need a JoobQ Pro key on the server.

Python, TypeScript, Ruby, Go, Rust and PHP install from their package registries (PyPI, npm, RubyGems, the Go module proxy, crates.io, Packagist). Java and .NET are not on Maven Central or NuGet yet: copy the SDK folder from the public repository github.com/azutoolkit/joobq-sdks and reference it by path. Elixir is new and not on Hex yet.

Install guide for every language
shard.yml · terminalNative shard
dependencies:
  # Queues and jobs (MIT)
  joobq:
    github: azutoolkit/joobq
    version: "= 0.8.2"

  # Or durable workflows, with JoobQ Pro (needs read access to the repository)
  # joobq_pro:
  #   github: azutoolkit/joobq-pro
  #   version: "= 0.8.0"
shards install

# src/worker.cr
#   require "joobq"         # or: require "joobq_pro"

JoobQ is a shard; JoobQ Pro (workflows) is a commercial shard in a private repository and brings the joobq revision it was tested with, so list one or the other.

Logos belong to their respective owners.

Data flow

SDK workers talk to the gateway, never to Redis

Your network

Your SDK workers

Python · TypeScript · Ruby · Go · Rust · Java · PHP · .NET · Elixir

PyTSRbGoRsJvPhp.NEx

Operators

Browser · console at /ui/

joobqui-selfhosted · one or more instances

JoobQUI server

  • SDK gateway/api/v1/sdk
  • Console API/api/v1
  • Workflow engineconducts SDK runs · Pro

Only outbound call: licence check-in every 15 min → app.joobq.io

Redis 6.2+

queues · leases · workflow histories

PostgreSQL

accounts · token hashes · audit

Your Crystal workers

Crjoobq + joobq_pro shards

The gateway holds the one implementation of retries, dead letters, leases and delays, so every language gets the same rules, and enqueues and starts are audited. More throughput comes from more server instances.

Your first worker

A complete worker, not an excerpt.

Each tab is a whole program, 15 to 28 lines: the Quickstart’s first worker, which the SDK test suite builds and starts against a real server in every one of these languages.

  1. 1

    Define a job

    A function or a small class, with a name and a queue. The payload is plain JSON.

  2. 2

    Connect

    The server’s address and its SDK token, from JOOBQ_GATEWAY_URL and JOOBQ_SDK_TOKEN. No Redis credentials.

  3. 3

    Start

    The worker registers itself and long-polls for work. It shows up on the console’s Workers page.

Then give it something to do

curl -sS -X POST "$JOOBQ_GATEWAY_URL/api/v1/sdk/jobs" \
  -H "Authorization: Bearer $JOOBQ_SDK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queue":"default","job_type":"welcome.email","payload":{"to":"ada@example.com"}}'

Welcome email sent to ada@example.com

worker.py15 lines
import os

from joobq import JoobQClient, JoobQWorker, job


@job("welcome.email", queue="default")
def welcome_email(payload, ctx):
    print(f"Welcome email sent to {payload['to']}")
    return {"sent_to": payload["to"]}


client = JoobQClient(os.environ["JOOBQ_GATEWAY_URL"], os.environ["JOOBQ_SDK_TOKEN"])
worker = JoobQWorker(client, "welcome-worker-1", ["default"])
worker.register_job(welcome_email)
worker.start()

Handles the job type welcome.email on the queue default, prints a line and returns the address.

Crystal has no tab here: a Crystal application runs its jobs on the JoobQ shards, straight from Redis.

Mix and match

Enqueue in one language, run it in another.

A job is a name, a queue and a JSON payload. Any SDK, or a plain HTTP request, can enqueue it, and whichever service registered that name runs it. The gateway holds the one implementation of retries, delays, leases and dead letters, so the rules do not change with the language.

  1. Enqueue

    Your API, in any language

    client.enqueue · ctx.enqueue · POST /api/v1/sdk/jobs

  2. Gateway

    One set of rules

    retries · delays · leases · dead letters

  3. Run

    The service that owns the job

    a worker in any of the SDK languages

worker.cr · job-delayJoobQUI
when "conf.produce"
  before = Conf.now_ms # before the call: the delay counts from when the job is stored
  jid = SealedJob.delay(for: 1.5.seconds, probe: probe, card_number: card_number, enqueued_before_ms: before)
  Conf.report("produce", probe, {"jid" => Conf.any(jid.to_s)})

A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.

One DSL · JoobQ Pro

The same workflow, spelled in your language.

A saga in each language: reserve, then charge, and release the reservation if a later step fails. Crystal runs it on the engine directly; an SDK declares it and the server’s engine conducts it, sending each step to a worker as its own task. Workflows need a JoobQ Pro key on the server.

How workflows run
worker.cr · wf-sagaJoobQ Pro
workflow "conf-saga-#{LANG}" do
  step "reserve", Reserve, input: {probe: input(:probe)}, compensate: compensation(Release, input: ref("steps.reserve.output.reservation"))
  step "charge", Charge
end,

A two-step saga with a compensation for the first step. From the conformance workers.

Built for teams

Small, predictable, pleasant to work with.