Skip to content

Commit 20690dd

Browse files
xuyushun441-sysos-zhuangclaude
authored
chore(services): remove BullMQ vaporware, reframe cluster packages as Redis-free-first (#1840)
* chore(services): remove BullMQ vaporware, reframe cluster packages as Redis-free-first The queue/cluster packages presented Redis/BullMQ as the production path, which contradicts the platform's actual direction (DB-first, single-node affinity, Redis-free Cloud/EE). Clean up the misleading surface: service-queue: - Delete the BullMQQueueAdapter skeleton (every method threw "not yet implemented (M10.43)"); remove the 'bullmq' adapter option, the dead throw branch, the reserved redisUrl field, and the index exports. No external consumers (grep-verified). DbQueueAdapter (sys_job_queue, lease-based claim) is the durable, multi-node, broker-free path. - Rewrite the README: it documented a fictional add/process/REST API and framed BullMQ/Redis as "production". Replace with the real publish/subscribe + DLQ surface and the db/memory/auto adapters. service-cluster: - Downgrade the header doc: only the redis remote driver exists (postgres/nats are not built). Call out the memory-driver split-brain footgun for multi-replica deployments. service-cluster-redis: - Add a README positioning it as a community-optional reference driver that proves the registerClusterDriver() SPI — explicitly NOT on the Redis-free Cloud/EE deployment path. Fix the wiring example to the real defineCluster({ driver: 'redis' }) / ClusterServicePlugin({ config }) API. Verified: turbo build green (CJS+ESM+DTS) for all three packages; service-queue 20/20 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: add empty changeset for cluster-pkg cleanup (no version impact) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3ecb012 commit 20690dd

8 files changed

Lines changed: 142 additions & 486 deletions

File tree

.changeset/cluster-pkg-cleanup.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
chore(services): remove BullMQ vaporware + reframe cluster packages Redis-first → Redis-free. Deletes a throw-only `BullMQQueueAdapter` stub (every method raised "not yet implemented (M10.43)"; no external consumers) and corrects misleading docs in service-queue/service-cluster/service-cluster-redis. No functional change to any working code path — empty changeset, no package version impact.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# @objectstack/service-cluster-redis
2+
3+
Redis driver for `@objectstack/service-cluster` — implements the cluster
4+
primitives `IPubSub` / `ILock` / `IKV` / `ICounter` against Redis using
5+
[`ioredis`](https://github.com/redis/ioredis).
6+
7+
## Status: community-optional reference driver
8+
9+
This package is the **reference remote driver** that proves the
10+
`registerClusterDriver()` SPI. It is **not** on the ObjectStack Cloud or
11+
ObjectOS EE deployment path — both run **Redis-free** (single-node-affinity
12+
routing + DB-backed queue/coordination). It is maintained as long as the
13+
cluster driver SPI is stable, but it is **not operated or supported by
14+
ObjectStack** as part of the managed/enterprise runtime.
15+
16+
Reach for it only when you self-host **multiple replicas that must share
17+
cluster primitives** with low latency — e.g. sub-second cross-process pub/sub
18+
or high-frequency cross-process locks. For most deployments the default
19+
`memory` driver (single process) or the DB-backed queue is sufficient; see
20+
`@objectstack/service-cluster` for when a remote driver is actually needed.
21+
22+
## Installation
23+
24+
```bash
25+
pnpm add @objectstack/service-cluster @objectstack/service-cluster-redis ioredis
26+
```
27+
28+
## Usage
29+
30+
Importing the package once at process start self-registers the `'redis'`
31+
driver, which `defineCluster({ driver: 'redis' })` then resolves.
32+
33+
```typescript
34+
import { ObjectKernel } from '@objectstack/core';
35+
import { ClusterServicePlugin } from '@objectstack/service-cluster';
36+
import '@objectstack/service-cluster-redis'; // self-registers the 'redis' driver
37+
38+
const kernel = new ObjectKernel();
39+
kernel.use(new ClusterServicePlugin({
40+
config: {
41+
driver: 'redis',
42+
url: process.env.REDIS_URL ?? 'redis://localhost:6379',
43+
nodeId: 'web-1',
44+
},
45+
}));
46+
await kernel.bootstrap();
47+
```
48+
49+
You can also build the service directly with `defineCluster({ driver: 'redis', url, nodeId })`,
50+
or pass a shared ioredis client via `driverOptions.client`.
51+
52+
## License
53+
54+
Apache-2.0. See [LICENSING.md](../../../LICENSING.md).
55+
56+
## See Also
57+
58+
- [@objectstack/service-cluster](../service-cluster) — primitives, SPI, and the
59+
default in-process `memory` driver

packages/services/service-cluster/src/index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
* @objectstack/service-cluster
55
*
66
* Pluggable cluster primitives (PubSub / Lock / KV / Counter) for
7-
* ObjectStack. The default `memory` driver is exported here; remote
8-
* drivers (postgres/redis/nats) ship as sibling packages and register
9-
* themselves via `registerClusterDriver()`.
7+
* ObjectStack. The default `memory` driver is exported here and is the
8+
* only driver needed for single-process runtimes.
9+
*
10+
* A remote driver is required only when running multiple processes that
11+
* must share these primitives. Remote drivers ship as sibling packages
12+
* and register via `registerClusterDriver()`; `@objectstack/service-cluster-redis`
13+
* is the reference remote driver. (Postgres/NATS drivers are not built —
14+
* add one on demand against the same SPI.)
15+
*
16+
* NOTE: the `memory` driver is per-process. Running multiple replicas on
17+
* the memory driver silently splits state (each process holds its own
18+
* locks/counters; pub/sub does not fan out across processes). Use a
19+
* remote driver for any multi-replica deployment.
1020
*
1121
* See `content/docs/concepts/cluster-semantics.mdx` for the protocol.
1222
*/

0 commit comments

Comments
 (0)