{"id":45278279,"url":"https://github.com/xraph/dispatch","last_synced_at":"2026-04-02T16:59:17.988Z","repository":{"id":339280356,"uuid":"1161250517","full_name":"xraph/dispatch","owner":"xraph","description":"Composable, extensible durable execution engine for Go","archived":false,"fork":false,"pushed_at":"2026-03-28T18:50:08.000Z","size":676,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T20:40:59.907Z","etag":null,"topics":["job-scheduler","queue","temporal","workflow-engine"],"latest_commit_sha":null,"homepage":"https://dispatch.xraph.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":"audit_hook/doc.go","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-18T22:37:54.000Z","updated_at":"2026-03-28T18:34:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xraph/dispatch","commit_stats":null,"previous_names":["xraph/dispatch"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/xraph/dispatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xraph%2Fdispatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xraph%2Fdispatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xraph%2Fdispatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xraph%2Fdispatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xraph","download_url":"https://codeload.github.com/xraph/dispatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xraph%2Fdispatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31310966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["job-scheduler","queue","temporal","workflow-engine"],"created_at":"2026-02-21T02:04:11.600Z","updated_at":"2026-04-02T16:59:17.976Z","avatar_url":"https://github.com/xraph.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dispatch\n\n**Composable durable execution engine for Go.**\n\nDispatch is a library — not a service. Import it, configure a store, and register jobs or workflows as ordinary Go functions. It handles background processing, workflow orchestration, cron scheduling, distributed coordination, and observability.\n\n## Features\n\n- **Background jobs** — Define typed handlers, enqueue with priority, retry with configurable backoff\n- **Durable workflows** — Multi-step functions with checkpointing, parallel execution, and event waiting\n- **Distributed cron** — Leader-elected cron scheduling with per-tenant support\n- **Dead letter queue** — Automatic promotion after exhausted retries; inspect, replay, and purge\n- **Distributed workers** — Worker registration, heartbeats, leader election, and work stealing\n- **Middleware** — Composable chain for logging, tracing, metrics, panic recovery, and scope injection\n- **Extension hooks** — Opt-in lifecycle interfaces for every job, workflow, cron, and shutdown event\n- **OpenTelemetry** — Built-in metrics and tracing via the `observability` and `middleware` packages\n- **Relay integration** — Emit typed webhook events at every lifecycle point via `relay_hook`\n- **Pluggable storage** — Memory, PostgreSQL (pgx/v5), Grove ORM, SQLite, Redis\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \"log/slog\"\n    \"os\"\n    \"os/signal\"\n\n    \"github.com/xraph/dispatch\"\n    \"github.com/xraph/dispatch/engine\"\n    \"github.com/xraph/dispatch/job\"\n    \"github.com/xraph/dispatch/store/memory\"\n)\n\ntype EmailInput struct {\n    To      string `json:\"to\"`\n    Subject string `json:\"subject\"`\n}\n\nvar SendEmail = job.NewDefinition(\"send_email\",\n    func(ctx context.Context, input EmailInput) error {\n        log.Printf(\"sending email to %s: %s\", input.To, input.Subject)\n        return nil\n    },\n)\n\nfunc main() {\n    ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)\n    defer stop()\n\n    d, err := dispatch.New(\n        dispatch.WithStore(memory.New()),\n        dispatch.WithLogger(slog.Default()),\n        dispatch.WithConcurrency(10),\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    eng := engine.Build(d)\n    engine.Register(eng, SendEmail)\n\n    if err := d.Start(ctx); err != nil {\n        log.Fatal(err)\n    }\n    defer d.Stop(ctx)\n\n    engine.Enqueue(ctx, eng, SendEmail, EmailInput{\n        To:      \"user@example.com\",\n        Subject: \"Welcome!\",\n    })\n\n    \u003c-ctx.Done()\n}\n```\n\n## Package Index\n\n| Package | Description |\n|---------|-------------|\n| `dispatch` | Root — `Dispatcher`, `Config`, options, errors, `Entity` base type |\n| `engine` | Wires all subsystems; `Build`, `Register`, `Enqueue`, `RegisterWorkflow`, `RegisterCron` |\n| `job` | `Job` entity, `State` machine, `Definition[T]`, `Registry` |\n| `workflow` | `Definition[T]`, `Run`, `State`, step checkpointing |\n| `cron` | `Entry`, `Scheduler`, distributed leader-elected cron |\n| `dlq` | `Entry`, `Service` — list, replay, purge |\n| `event` | `Event` entity and store interface |\n| `cluster` | `Worker`, distributed coordination, heartbeats, work stealing |\n| `queue` | `Config`, `Manager` — per-queue rate limiting and concurrency |\n| `middleware` | `Middleware`, `Chain`, built-ins (Logging, Recover, Timeout, Tracing, Metrics, Scope) |\n| `ext` | Extension interface, lifecycle hook interfaces, `Registry` |\n| `backoff` | Retry backoff strategies |\n| `observability` | OpenTelemetry `MetricsExtension` for system-wide counters |\n| `id` | TypeID-based identifiers (`JobID`, `RunID`, `CronID`, etc.) |\n| `api` | Forge-style HTTP admin API handlers |\n| `scope` | Forge scope helpers — tenant ID extraction from context |\n| `relay_hook` | Relay webhook delivery extension |\n| `extension` | Forge framework integration adapter |\n| `store` | Composite `Store` interface |\n| `store/memory` | In-memory backend (testing) |\n| `store/postgres` | PostgreSQL backend (pgx/v5) |\n| `store/grovestore` | Grove ORM backend |\n| `store/sqlite` | SQLite backend |\n| `store/redis` | Redis backend |\n| `cluster/k8s` | Kubernetes consensus for leader election |\n\n## Store Backends\n\n| Package | Driver | Use Case |\n|---------|--------|----------|\n| `store/memory` | — | Development and testing |\n| `store/postgres` | pgx/v5 | Production (recommended) |\n| `store/grovestore` | Grove ORM | Production (Grove-based projects) |\n| `store/sqlite` | modernc/sqlite | Embedded / single-node |\n| `store/redis` | go-redis | Redis-backed queue state |\n\n## Install\n\n```bash\ngo get github.com/xraph/dispatch\n```\n\nRequires Go 1.25+.\n\n## Documentation\n\nFull documentation is available at the docs portal: [`dispatch/docs`](./docs).\n\nRun locally:\n\n```bash\ncd docs\npnpm install\npnpm dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxraph%2Fdispatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxraph%2Fdispatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxraph%2Fdispatch/lists"}