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

Queues

Background jobs, native in Crystal.

In Crystal, jobs are structs checked by the compiler. JoobQ keeps them in Redis, runs them on fibers, and stops cleanly on SIGTERM. Workers in the other 9 languages reach the same queues through the SDK gateway of a self-hosted JoobQUI: they long-poll it over HTTPS and never connect to Redis.

See it work

The code you write, and what you see when it runs.

Samples are cut from the conformance workers, which run against a real server in 10 languages. Screenshots are the JoobQUI console with sample data.

A report call in a sample (Report in .NET) is the test suite recording what the handler received. Your handler does its own work there.

Typed jobs

A job is a struct the compiler checks

Properties are typed and arguments travel as JSON. A field marked encrypted_property (encrypted_fields in the SDKs) is sealed with AES-256-GCM before it is stored, and the console shows it as [encrypted].

worker.cr · job-sealedJoobQ · OSS
struct SealedJob
  include JoobQ::Job

  @queue = SEALED
  @retries = 3
  @max_retries = 3
  @expires = 1.day.from_now.to_unix_ms

  property probe : String = ""
  property enqueued_before_ms : Int64 = 0_i64
  encrypted_property card_number : String = "", job_name: "Conf::SealedJob"

  def initialize
  end

  def initialize(@probe : String, @card_number : String, @enqueued_before_ms : Int64 = 0_i64)
  end

  def perform
    Conf.report("sealed", probe, {"card_sha256" => Conf.any(Digest::SHA256.hexdigest(card_number)), "enqueued_before_ms" => Conf.any(enqueued_before_ms)})
  end
end

A job with a sealed field.

The console’s Jobs page: a table of jobs with their queue, state, attempts and arguments.The console’s Jobs page: a table of jobs with their queue, state, attempts and arguments.
Jobs page: what is waiting, delayed, retrying or running. JoobQUI console, sample data.

Retries and dead letters

Fail, back off, try again; then park it

A transient error is retried with randomized exponential backoff in Crystal, and after the gateway’s exponential delay in the SDKs. A non-retryable error, or the last attempt, moves the job to the dead-letter set with its error, where it can be inspected and redriven. Delivery is at least once, so write jobs that are safe to repeat.

worker.cr · job-retryJoobQ · OSS
when "conf.retry"
  raise "transient failure on attempt #{attempt}" if attempt < 3
  Conf.report("retry", probe, {"attempt" => Conf.any(attempt)})
when "conf.dead"
  Conf.report("dead_attempt", probe)
  raise JoobQ::NonRetryableError.new("permanent failure #{probe}")

One job fails twice and then succeeds; another raises a non-retryable error and is dead-lettered.

The console’s Dead letters page: failed jobs with their error class, message and stack trace, and Retry and Delete actions.The console’s Dead letters page: failed jobs with their error class, message and stack trace, and Retry and Delete actions.
Dead letters page: the error, its stack trace, retry or delete. JoobQUI console, sample data.

Delays and schedules

Run it later, or on a schedule

delay(for:) in Crystal and a delay option in the SDKs run a job later; cron and interval schedules are declared in code and can be paused, resumed or run now from the console.

worker.cr · job-delayJoobQ · OSS
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 job enqueued to run 1.5 seconds later.

The console’s Schedules page: recurring jobs with their cron expression, next run and Pause and Run now actions.The console’s Schedules page: recurring jobs with their cron expression, next run and Pause and Run now actions.
Schedules page: next run, pause, resume, run now. JoobQUI console, sample data.

Queues

Throttle, pause and resize a queue

A queue has a worker count and, if you want one, a throttle of so many jobs per period, applied when a worker claims a job. From the console an operator pauses, resumes, clears or resizes a queue while it runs.

configJoobQ · OSS
JoobQ.configure do
  queue "my_queue", 10, MyJob, {limit: 100, period: 1.minute}
end

The fourth argument of the queue macro is the throttle.

A queue throttle is set on the queue, in Crystal or from the console. The SDK tabs show the other limit, a named rate limit a handler asks for (JoobQ Pro); Crystal calls JoobQPro::RateLimiter for it.

The console’s Queues page: one card per queue with its waiting, running and dead counts, a concurrency slider, and Pause and Clear buttons.The console’s Queues page: one card per queue with its waiting, running and dead counts, a concurrency slider, and Pause and Clear buttons.
Queues page: pause, resume, clear and concurrency per queue. JoobQUI console, sample data.

Batches and metrics · JoobQ Pro

Fan out a batch, watch the latency

JoobQ Pro adds batches whose callbacks run as ordinary jobs when the members finish, latency percentiles and alert rules. The overview charts throughput and p50, p95 and p99 live.

worker.py · batchJoobQ Pro
@job("conf.produce_batch", queue=QUEUE)
def produce_batch_job(payload, ctx):
    probe = payload["probe"]
    members = [{"queue": QUEUE, "job_type": "conf.batchmember", "payload": {"probe": probe, "n": n, "fail": n == 3},
                "max_retries": 0} for n in (1, 2, 3)]
    done = {"queue": QUEUE, "job_type": "conf.batchdone", "payload": {"probe": probe}}
    res = ctx.create_batch(members, on_complete=done, on_failure=done, description="conformance " + probe)
    report(ctx, "produce_batch", payload, batch_id=res["batch_id"], total=res["total"])


@job("conf.batchdone", queue=QUEUE)
def batchdone_job(payload, ctx):
    batch = payload["batch"]  # {id, kind, total, succeeded, failed}
    status = ctx.get_batch(batch["id"])["status"]
    report(ctx, "batchdone", payload, kind=batch["kind"], total=batch["total"], succeeded=batch["succeeded"],
           failed=batch["failed"], status=status)

A batch of three jobs with completion callbacks, and the callback reading the batch’s result.

Crystal has no tab: it runs Pro batches on the shard, with JoobQPro::Batch, not through the gateway.

The console’s Overview page: throughput and latency charts, queue backlog and busy workers.The console’s Overview page: throughput and latency charts, queue backlog and busy workers.
Overview page: throughput, latency percentiles, backlog. JoobQUI console, sample data.
Tour the whole console

Engineering guarantees

Architecture specs, not adjectives

  • Encryption01

    AES-256-GCM field-level sealing

    Chosen job fields are sealed before they are stored: at rest in Redis, backups, dead letters and the console. Key rotation built in.

    • encrypted_property
    • encrypted_fields
    • JOOBQUI_PAYLOAD_KEYS
  • Worker ecosystem02

    Crystal native + 9 SDK languages

    Python, TypeScript, Ruby, Go, Rust, Java, PHP, .NET and Elixir workers long-poll the SDK gateway; they never hold Redis credentials.

    • joobq
    • joobq_pro
    • /api/v1/sdk
  • Auth & governance03

    3-role RBAC · OIDC SSO · TOTP

    viewer, operator and admin enforced on every route; OpenID Connect single sign-on, TOTP two-factor and an audit row for every state change.

    • viewer
    • operator
    • admin
    • audit log
  • Deployment04

    One docker compose stack

    The server and PostgreSQL, with Redis (bundled or your own) and Caddy for HTTPS as optional profiles. Settings and licence persist in a /data volume.

    • selfhosted.compose.yml
    • --profile redis
    • --profile https