# SoberJob **Repository Path**: ly2351/sober-job ## Basic Information - **Project Name**: SoberJob - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2026-11-16 - **Last Updated**: 2026-11-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SoberJob A clean-room .NET distributed job scheduling platform inspired by XXL-JOB, Hangfire and Quartz.NET — MIT licensed, AOT-friendly, with idempotent triggering, fixed shard slots, watchdog failure detection, and a built-in Blazor console. > **Status**: core, governance, high availability, console and the minimal general-purpose task types are > implemented. See [Implementation Review & Revised Plan](docs/11-实施复盘与修订计划.md) for the honest status table. ## Why - **License**: MIT. No GPL obligations; no source copied from XXL-JOB. - **Idempotency**: unique `(job_id, fire_time, shard)` index plus a 24h `Idempotency-Key` response replay. - **Security**: HMAC tokens with `jti` revocation, OIDC RS256/JWKS tokens, RBAC, and object-level ACL. - **Recovery**: automatic retries, dead-letter queue, manual rerun, dispatch ACK with timeout redelivery, and at-least-once delivery. - **Fairness**: task priority, tenant round-robin scheduling, and global/tenant/job token-bucket rate limits. - **Operations**: windowed backfill with dry-run, exclusion calendars, firing-origin audit, and hot-reloaded runtime limits. - **Schema**: four-dialect migration export (SQLite / PostgreSQL / MySQL / SQL Server); runtime providers: SQLite, PostgreSQL, MySQL and SQL Server (all four). - **Observability**: `X-SoberJob-Trace-Id` propagation and Prometheus-compatible `/metrics`. - **Fixed slots**: leased `(job_id, shard_index)` slots with stable numbering across worker churn. - **Silent-failure detection**: watchdog rules evaluate success counts; database-backed dynamic rules support safe whitelist condition expressions, a visual builder, dry-run history, a versioned rule template library with JSON import/export, failed-delivery retry with exponential backoff and escalation to critical level, maintenance-window silence rules, cross-process deduplication, and a Blazor management page. - **Lean dependencies**: 4 first-party Microsoft runtime packages, zero third-party transitive dependencies. - **AOT**: Native AOT publish verified via `samples/Sample.AotSmoke`. ## Quick start ```bash dotnet restore SoberJob.slnx --locked-mode dotnet build SoberJob.slnx -c Release dotnet test SoberJob.slnx -c Release --no-build dotnet run --project src/SoberJob.Server dotnet run --project samples/Sample.InProcess dotnet run --project src/SoberJob.Dashboard ``` The server listens on `http://localhost:5080` by default. Health probes: `/healthz`, `/readyz`, `/metrics`. ## Components | Project | Role | |---|---| | `SoberJob.Core` | Time wheel, misfire policies, routing, blocking, state machine, watchdog | | `SoberJob.Cron` | Hand-written Cron parser with DST-aware time zone support | | `SoberJob.Data` / `Storage.Sqlite` / `Storage.PostgreSql` / `Storage.MySql` / `Storage.SqlServer` | Schema, migrations, SQLite/PostgreSQL/MySQL/SQL Server stores, shard leases | | `SoberJob.Server` | Management API, worker protocol (SSE), governance, audit, alarms | | `SoberJob.Worker` | Execution engine, reconnect with `Last-Event-ID`, graceful drain | | `SoberJob.Client` | Zero-dependency strongly typed API client (AOT safe) | | `SoberJob.Dashboard` | Minimal Blazor Server console | | `SoberJob.Protocol` / `Worker.Generators` | Wire contracts and source generators | ## Task types - `InProcess` — .NET handlers registered via `AddSoberJobHandler`. - `soberjob.http` — HTTP calls with SSRF protection (private networks denied by default). - `soberjob.script` — subprocess scripts, disabled by default, command allowlist required. - DAG workflows are available in v1.1 (SQLite/MySQL/SQL Server); `soberjob.container` is available in v1.4 (opt-in, image allowlist). Use the SDK to trigger jobs: ```csharp var client = new SoberJobClient(httpClient) { Token = "" }; await client.TriggerAsync(jobId); ``` ## Documentation - [Product design & differentiation](docs/02-产品设计与差异化.md) - [Architecture & data model](docs/03-技术架构与数据模型.md) - [API & protocol](docs/04-API与协议规范.md) - [Task types & scripts](docs/08-任务类型与脚本执行.md) - [Governance & multi-tenancy](docs/09-平台治理与多租户.md) - [High availability & slots](docs/10-高可用与槽位分片.md) - [Deployment & operations](docs/12-部署与运维.md) Most design documents are currently Chinese; the status and operational sections are kept in sync with code. ## License MIT — see [LICENSE](LICENSE).