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 languagedependencies:
# 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.
pip install joobq
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the serverimport os
from joobq import Job, JoobQClient, JoobQWorker
client = JoobQClient(os.environ["JOOBQ_GATEWAY_URL"], os.environ["JOOBQ_SDK_TOKEN"])One package, joobq, on PyPI. Standard library only.
npm install joobq
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the serverimport { JoobQClient, JoobQWorker, defineJob } from 'joobq'
const client = new JoobQClient(process.env.JOOBQ_GATEWAY_URL!, process.env.JOOBQ_SDK_TOKEN!)The npm package joobq: an ES module with its type declarations, on Node built-ins (fetch, node:crypto).
gem install joobq # or: gem "joobq" in your Gemfile
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the serverrequire "joobq"
client = JoobQ::Client.new(gateway_url: ENV.fetch("JOOBQ_GATEWAY_URL"), token: ENV.fetch("JOOBQ_SDK_TOKEN"))The gem joobq, on RubyGems, on json and net/http.
go get github.com/azutoolkit/joobq-sdk-go
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the serverimport joobq "github.com/azutoolkit/joobq-sdk-go"
client := joobq.NewClient(os.Getenv("JOOBQ_GATEWAY_URL"), os.Getenv("JOOBQ_SDK_TOKEN"))Module github.com/azutoolkit/joobq-sdk-go (Go 1.22, no dependencies), fetched with go get.
cargo add joobq
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the serveruse joobq::{JobDef, JoobQClient, Workflow};
let client = JoobQClient::new(env::var("JOOBQ_GATEWAY_URL")?, env::var("JOOBQ_SDK_TOKEN")?);Crate joobq on crates.io (edition 2021; pinned dependencies: serde, serde_json, ureq with rustls, signal-hook).
mkdir -p vendor/joobq-sdk/java
cp -r joobq-sdks/java/src vendor/joobq-sdk/java/
javac -d out $(find vendor/joobq-sdk/java/src/main/java -name '*.java') App.java
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the server
java -cp out Appimport io.joobq.JoobQClient;
import io.joobq.JoobQClient.JobDefinition;
JoobQClient client = new JoobQClient(System.getenv("JOOBQ_GATEWAY_URL"), System.getenv("JOOBQ_SDK_TOKEN"));One source file, io/joobq/JoobQClient.java, on the JDK only (java.net.http, records). Not on Maven Central: compile it with your sources.
composer require azutoolkit/joobq
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the server<?php
require __DIR__ . '/vendor/autoload.php';
use JoobQ\JoobQClient;
use JoobQ\JoobQWorker;
$client = new JoobQClient(getenv('JOOBQ_GATEWAY_URL'), getenv('JOOBQ_SDK_TOKEN'));The Composer package azutoolkit/joobq, on Packagist: one file, namespace JoobQ (readonly properties), on the curl and json extensions.
# SDK-style projects compile every .cs file under the project folder
mkdir -p vendor/joobq-sdk/dotnet
cp joobq-sdks/dotnet/JoobQClient.cs vendor/joobq-sdk/dotnet/
export JOOBQ_GATEWAY_URL=http://127.0.0.1:8080 # the JoobQUI server
export JOOBQ_SDK_TOKEN=... # the value of JOOBQUI_SDK_TOKEN on the server
dotnet runusing JoobQ;
var client = new JoobQClient(
Environment.GetEnvironmentVariable("JOOBQ_GATEWAY_URL")!,
Environment.GetEnvironmentVariable("JOOBQ_SDK_TOKEN")!);One file, JoobQClient.cs, namespace JoobQ, on System.Net.Http and System.Text.Json. Not on NuGet: copy it into your project folder.
defp deps do
[
{:joobq_ex, git: "https://github.com/azutoolkit/joobq-sdks.git", sparse: "elixir", tag: "v0.8.0"}
]
endchildren = [
{JoobQ,
url: System.fetch_env!("JOOBQ_GATEWAY_URL"),
token: System.fetch_env!("JOOBQ_SDK_TOKEN"),
queues: ["mail"],
workers: [MyApp.Welcome]}
]The package joobq_ex (Elixir 1.16 or newer; on finch, jason and telemetry). Not on Hex yet: it installs from the public joobq-sdks repository as a git dependency, pinned to your server’s release tag.
Logos belong to their respective owners.
Data flow
SDK workers talk to the gateway, never to Redis
Your SDK workers
Python · TypeScript · Ruby · Go · Rust · Java · PHP · .NET · Elixir
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
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
Define a job
A function or a small class, with a name and a queue. The payload is plain JSON.
- 2
Connect
The server’s address and its SDK token, from
JOOBQ_GATEWAY_URLandJOOBQ_SDK_TOKEN. No Redis credentials. - 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
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.
import { JoobQClient, JoobQWorker, defineJob } from 'joobq'
const welcomeEmail = defineJob({
name: 'welcome.email',
queue: 'default',
perform: async (payload) => {
console.log(`Welcome email sent to ${payload.to}`)
return { sent_to: payload.to }
},
})
const client = new JoobQClient(process.env.JOOBQ_GATEWAY_URL!, process.env.JOOBQ_SDK_TOKEN!)
const worker = new JoobQWorker(client, { workerId: 'welcome-worker-1', taskQueues: ['default'] })
worker.registerJob(welcomeEmail)
await worker.start()Handles the job type welcome.email on the queue default, prints a line and returns the address.
require "joobq"
class WelcomeEmail
include JoobQ::Job
job_name "welcome.email"
queue "default"
def self.perform(payload, ctx)
puts "Welcome email sent to #{payload["to"]}"
{ "sent_to" => payload["to"] }
end
end
client = JoobQ::Client.new(gateway_url: ENV.fetch("JOOBQ_GATEWAY_URL"), token: ENV.fetch("JOOBQ_SDK_TOKEN"))
worker = JoobQ::Worker.new(client: client, worker_id: "welcome-worker-1", task_queues: ["default"])
worker.register_job(WelcomeEmail)
worker.startHandles the job type welcome.email on the queue default, prints a line and returns the address.
package main
import (
"context"
"fmt"
"log"
"os"
joobq "github.com/azutoolkit/joobq-sdk-go"
)
func main() {
welcomeEmail := joobq.DefineJob("welcome.email", joobq.JobOptions{Queue: "default"},
func(payload map[string]any, ec *joobq.ExecutionContext) (any, error) {
fmt.Println("Welcome email sent to", payload["to"])
return map[string]any{"sent_to": payload["to"]}, nil
})
client := joobq.NewClient(os.Getenv("JOOBQ_GATEWAY_URL"), os.Getenv("JOOBQ_SDK_TOKEN"))
worker := joobq.NewWorker(client, "welcome-worker-1", []string{"default"})
worker.RegisterJob(welcomeEmail)
if err := worker.Run(context.Background()); err != nil {
log.Fatal(err)
}
}Handles the job type welcome.email on the queue default, prints a line and returns the address.
use joobq::{json, ExecutionContext, JobDef, JoobQClient, Value, Worker};
use std::env;
fn main() {
let welcome_email = JobDef::new("welcome.email", "default", |payload: Value, _ctx: &ExecutionContext| {
println!("Welcome email sent to {}", payload["to"].as_str().unwrap_or_default());
Ok(json!({ "sent_to": payload["to"] }))
});
let gateway_url = env::var("JOOBQ_GATEWAY_URL").expect("JOOBQ_GATEWAY_URL is not set");
let token = env::var("JOOBQ_SDK_TOKEN").expect("JOOBQ_SDK_TOKEN is not set");
let client = JoobQClient::new(gateway_url, token);
let worker = Worker::new(client, "welcome-worker-1", vec!["default".to_string()]).register_job(welcome_email);
if let Err(error) = worker.run() {
eprintln!("{error}");
}
}Handles the job type welcome.email on the queue default, prints a line and returns the address.
import io.joobq.JoobQClient;
import io.joobq.JoobQClient.JobDefinition;
import io.joobq.JoobQClient.JoobQWorker;
import java.util.List;
import java.util.Map;
public class WelcomeWorker {
public static void main(String[] args) throws Exception {
JobDefinition welcomeEmail = JobDefinition.of("welcome.email", "default", 3, (payload, ctx) -> {
Object to = ((Map<?, ?>) payload).get("to");
System.out.println("Welcome email sent to " + to);
return Map.of("sent_to", to);
});
JoobQClient client = new JoobQClient(System.getenv("JOOBQ_GATEWAY_URL"), System.getenv("JOOBQ_SDK_TOKEN"));
JoobQWorker worker = new JoobQWorker(client, "welcome-worker-1", List.of("default"));
worker.register(welcomeEmail);
worker.run();
}
}Handles the job type welcome.email on the queue default, prints a line and returns the address.
<?php
declare(strict_types=1);
require_once 'JoobQClient.php';
use JoobQ\ExecutionContext;
use JoobQ\Job;
use JoobQ\JoobQClient;
use JoobQ\JoobQWorker;
final class WelcomeEmail extends Job
{
public static function jobName(): string
{
return 'welcome.email';
}
public static function perform(array $payload, ExecutionContext $ctx): mixed
{
echo "Welcome email sent to {$payload['to']}\n";
return ['sent_to' => $payload['to']];
}
}
$client = new JoobQClient((string)getenv('JOOBQ_GATEWAY_URL'), (string)getenv('JOOBQ_SDK_TOKEN'));
$worker = new JoobQWorker($client, 'welcome-worker-1', ['default']);
$worker->registerJob(WelcomeEmail::class);
$worker->run();Handles the job type welcome.email on the queue default, prints a line and returns the address.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JoobQ;
var welcomeEmail = JobDefinition.Define("welcome.email", "default", 3, (payload, ctx) =>
{
var to = payload?["to"]?.GetValue<string>();
Console.WriteLine($"Welcome email sent to {to}");
return Task.FromResult<object?>(new Dictionary<string, object?> { ["sent_to"] = to });
});
var client = new JoobQClient(
Environment.GetEnvironmentVariable("JOOBQ_GATEWAY_URL")!,
Environment.GetEnvironmentVariable("JOOBQ_SDK_TOKEN")!);
var worker = new JoobQWorker(client, "welcome-worker-1", new[] { "default" });
worker.Register(welcomeEmail);
await worker.RunAsync();Handles the job type welcome.email on the queue default, prints a line and returns the address.
Mix.install([{:joobq_ex, git: "https://github.com/azutoolkit/joobq-sdks.git", sparse: "elixir", tag: "v0.8.0"}])
defmodule WelcomeEmail do
use JoobQ.Worker, queue: "default", job_type: "welcome.email"
@impl JoobQ.Worker
def perform(%JoobQ.Job{payload: %{"to" => to}}) do
IO.puts("Welcome email sent to #{to}")
{:ok, %{"sent_to" => to}}
end
end
worker = [
url: System.fetch_env!("JOOBQ_GATEWAY_URL"),
token: System.fetch_env!("JOOBQ_SDK_TOKEN"),
worker_id: "welcome-worker-1",
queues: ["default"],
workers: [WelcomeEmail]
]
{:ok, _supervisor} = Supervisor.start_link([{JoobQ, worker}], strategy: :one_for_one)
Process.sleep(:infinity)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.
Enqueue
Your API, in any language
client.enqueue · ctx.enqueue · POST /api/v1/sdk/jobs
Gateway
One set of rules
retries · delays · leases · dead letters
Run
The service that owns the job
a worker in any of the SDK languages
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.
@job("conf.produce", queue=QUEUE)
def produce_job(payload, ctx):
before = now_ms() # before the call: the gateway counts the delay from when it receives it
res = ctx.enqueue(sealed_job, {"probe": payload["probe"], "card_number": payload["card_number"], "enqueued_before_ms": before},
delay_ms=1500)
report(ctx, "produce", payload, jid=res["jid"])A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
defineJob({ name: 'conf.produce', queue: QUEUE, perform: async (p, ctx) => {
const before = Date.now() // before the call: the gateway counts the delay from when it receives it
const res = await ctx.enqueue(sealed, { probe: p.probe, card_number: p.card_number, enqueued_before_ms: before }, { delayMs: 1500 })
return report(ctx, 'produce', p, { jid: res.jid })
} }),A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
class ProduceJob
include JoobQ::Job
job_name "conf.produce"
queue QUEUE
def self.perform(p, ctx)
before = now_ms # before the call: the gateway counts the delay from when it receives it
res = ctx.enqueue(SealedJob, { probe: p["probe"], card_number: p["card_number"], enqueued_before_ms: before }, delay_ms: 1500)
report(ctx, "produce", p, jid: res["jid"])
end
endA handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
joobq.DefineJob("conf.produce", opts, func(p map[string]any, ec *EC) (any, error) {
before := nowMs() // before the call: the gateway counts the delay from when it receives it
jid, err := sealed.EnqueueFrom(ec, map[string]any{"probe": p["probe"], "card_number": p["card_number"], "enqueued_before_ms": before}, joobq.EnqueueOptions{DelayMs: 1500})
if err != nil {
return nil, err
}
return report(ec, "produce", p, map[string]any{"jid": jid})
}),A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
JobDef::new("conf.produce", queue.clone(), move |p: Value, ctx: &Ctx| {
let before = now_ms(); // before the call: the gateway counts the delay from when it receives it
let jid = ctx.enqueue(&producer_sealed, json!({"probe": p["probe"], "card_number": p["card_number"], "enqueued_before_ms": before}), EnqueueOptions { delay_ms: 1500, ..Default::default() })?;
report(ctx, "produce", &p, json!({"jid": jid}))
}),A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
JobDefinition.of("conf.produce", QUEUE, 3, (p, ctx) -> {
long before = System.currentTimeMillis(); // before the call: the gateway counts the delay from when it receives it
String jid = ctx.enqueue(sealed, map("probe", m(p).get("probe"), "card_number", m(p).get("card_number"), "enqueued_before_ms", before), EnqueueOptions.delay(1500));
return report(ctx, "produce", p, map("jid", jid));
}),A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
final class ProduceJob extends ConfJob
{
public static function jobName(): string { return 'conf.produce'; }
public static function perform(array $p, ExecutionContext $ctx): mixed
{
$before = now_ms(); // before the call: the gateway counts the delay from when it receives it
$res = $ctx->enqueue(SealedJob::class, ['probe' => $p['probe'], 'card_number' => $p['card_number'], 'enqueued_before_ms' => $before], ['delay_ms' => 1500]);
return report($ctx, 'produce', $p, ['jid' => $res['jid']]);
}
}A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
JobDefinition.Define("conf.produce", Queue, 3, async (p, ctx) =>
{
var before = NowMs(); // before the call: the gateway counts the delay from when it receives it
var jid = await ctx.EnqueueAsync(sealedJob, new { probe = p?["probe"]?.GetValue<string>(), card_number = p?["card_number"]?.GetValue<string>(), enqueued_before_ms = before }, new EnqueueOptions(DelayMs: 1500));
return await Report(ctx, "produce", p, new() { ["jid"] = jid });
}),A handler enqueues a second job through its context, to run 1.5 seconds later. From the conformance workers.
defmodule Conformance.ProduceJob do
use JoobQ.Worker, queue: "conf", job_type: "conf.produce"
@impl JoobQ.Worker
def perform(%JoobQ.Job{payload: p}) do
# Before the call: the gateway counts the delay from when it receives it.
before = Conformance.now_ms()
sealed = %{probe: p["probe"], card_number: p["card_number"], enqueued_before_ms: before}
{:ok, %{"jid" => jid}} =
Conformance.enqueue("conf.sealed", sealed, delay_ms: 1_500, encrypt_fields: ["card_number"])
Conformance.report("produce", p, %{jid: jid})
end
endA 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 runworkflow "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.
wf("saga").step("reserve", reserve, input={"probe": input("probe")},
compensate=compensation(release, input=output("reserve", "reservation")))
.step("charge", charge),A two-step saga with a compensation for the first step. From the conformance workers.
wf('saga')
.step('reserve', async (i: any) => ({ reservation: `res-${i.probe}` }), {
input: { probe: input('probe') },
compensate: compensation(async (i: any) => ({ released: i }), { input: output('reserve', 'reservation') }),
})
.step('charge', charge),A two-step saga with a compensation for the first step. From the conformance workers.
wf("saga")
.step("reserve", ->(i, _ctx) { { reservation: "res-#{i['probe']}" } }, input: { probe: input("probe") },
compensate: compensation(->(i, _ctx) { { released: i } }, input: output("reserve", "reservation")))
.step("charge", CHARGE),A two-step saga with a compensation for the first step. From the conformance workers.
wf("saga").
Step("reserve", func(in map[string]any, ec *EC) (any, error) {
return map[string]any{"reservation": fmt.Sprintf("res-%v", in["probe"])}, nil
}, joobq.WithInput(map[string]any{"probe": joobq.Input("probe")}),
joobq.WithCompensate(joobq.Compensation(func(in map[string]any, ec *EC) (any, error) {
return map[string]any{"released": in["value"]}, nil
}, joobq.Output("reserve", "reservation")))).
Step("charge", charge),A two-step saga with a compensation for the first step. From the conformance workers.
wf("saga")
.step_with("reserve", |i: Value, _ctx: &Ctx| Ok(json!({"reservation": format!("res-{}", i["probe"].as_str().unwrap_or(""))})), StepOptions {
input: json!({"probe": input(Some("probe"))}),
compensate: Some(Compensation::new(|i: Value, _ctx: &Ctx| Ok(json!({"released": i})), Some(output("reserve", Some("reservation"))))),
..Default::default()
})
.step("charge", |_i: Value, _ctx: &Ctx| Err(Error::non_retryable("card declined"))),A two-step saga with a compensation for the first step. From the conformance workers.
wf("saga")
.step("reserve", (i, ctx) -> map("reservation", "res-" + m(i).get("probe")),
StepOptions.input(map("probe", DSL.input("probe")))
.compensate(DSL.compensation((i, ctx) -> map("released", i), DSL.output("reserve", "reservation"))))
.step("charge", Worker::charge),A two-step saga with a compensation for the first step. From the conformance workers.
wf('saga')
->step('reserve', fn ($i, $ctx) => ['reservation' => 'res-' . $i['probe']], input: ['probe' => DSL::input('probe')],
compensate: DSL::compensation(fn ($i, $ctx) => ['released' => $i], DSL::output('reserve', 'reservation')))
->step('charge', fn ($i, $ctx) => throw new NonRetryableException('card declined')),A two-step saga with a compensation for the first step. From the conformance workers.
Wf("saga")
.Step("reserve", (i, ctx) => Task.FromResult<object?>(new { reservation = "res-" + i?["probe"]?.GetValue<string>() }), input: new { probe = Dsl.Input("probe") },
compensate: Dsl.Compensation((i, ctx) => Task.FromResult<object?>(new { released = i }), Dsl.Output("reserve", "reservation")))
.Step("charge", (i, ctx) => throw new NonRetryableException("card declined")),A two-step saga with a compensation for the first step. From the conformance workers.
def saga do
release = compensation(fn input, _job -> {:ok, %{released: input}} end, input: output("reserve", "reservation"))
wf("saga")
|> step("reserve", fn input, _job -> {:ok, %{reservation: "res-#{input.probe}"}} end,
input: %{probe: input("probe")},
compensate: release
)
|> step("charge", &Steps.charge/2)
endA two-step saga with a compensation for the first step. From the conformance workers.
Built for teams
Small, predictable, pleasant to work with.
Runs inside your app
A worker boots your application the way a web request does and uses its configuration, database pools and clients. No SDK carries an application object of its own.
Request context travels
What the producer attached (
tenant_id,request_id,traceparent) arrives in the handler asctx.context, and carries on to the jobs that handler enqueues.Middleware you already know
worker.use(mw)wraps every task: time it, log it, change its output or skip it. The first one registered is the outermost.Nothing to expose
Workers long-poll over HTTPS and are woken the moment a job lands. No inbound port, and no Redis credentials outside the server.
Errors you can read
A failed job reports its error class, message and stack frames as its own language prints them, and the console’s dead-letter view shows them that way.
Tested as a set
One conformance suite runs 10 languages against a real server: retries, delays, sealed fields, middleware and workflows.