@openreachtech/hora-skills-ort-renchan 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.ja.md +135 -0
- package/README.md +135 -0
- package/dist/skills/hor-agent-loop/SKILL.md +123 -0
- package/dist/skills/hor-agent-loop/references/core.md +485 -0
- package/dist/skills/hor-agent-loop/references/graphql-integration.md +178 -0
- package/dist/skills/hor-agent-loop/references/renchan-job-integration.md +368 -0
- package/dist/skills/hor-agent-loop/references/testing.md +492 -0
- package/dist/skills/hor-ai-agent-structure/SKILL.md +403 -0
- package/dist/skills/hor-ai-agent-structure/references/loop-and-actions.md +100 -0
- package/dist/skills/hor-ai-prompt-document-store/SKILL.md +220 -0
- package/dist/skills/hor-ai-prompt-document-store/references/models-and-composition.md +156 -0
- package/dist/skills/hor-backend-testing/SKILL.md +118 -0
- package/dist/skills/hor-backend-testing/references/placement-and-ordering.md +89 -0
- package/dist/skills/hor-backend-testing/references/purity-and-mocks.md +82 -0
- package/dist/skills/hor-backend-testing/references/running-tests.md +186 -0
- package/dist/skills/hor-bank-id/SKILL.md +91 -0
- package/dist/skills/hor-build-e2e-test-environment/SKILL.md +609 -0
- package/dist/skills/hor-build-e2e-test-environment/references/compose-definition.md +368 -0
- package/dist/skills/hor-build-e2e-test-environment/references/edge-and-proxy.md +287 -0
- package/dist/skills/hor-build-e2e-test-environment/references/environment-and-ports.md +201 -0
- package/dist/skills/hor-build-e2e-test-environment/references/runner-and-lifecycle.md +330 -0
- package/dist/skills/hor-build-e2e-test-environment/references/seed-data.md +145 -0
- package/dist/skills/hor-build-e2e-test-environment/references/windows-runner.md +146 -0
- package/dist/skills/hor-constant-definition/SKILL.md +139 -0
- package/dist/skills/hor-cookie-authentication/SKILL.md +33 -0
- package/dist/skills/hor-cookie-authentication/references/auth-filter.md +55 -0
- package/dist/skills/hor-cookie-authentication/references/cookie-context.md +53 -0
- package/dist/skills/hor-cookie-authentication/references/dev-login-seeder.md +22 -0
- package/dist/skills/hor-cookie-authentication/references/environment.md +64 -0
- package/dist/skills/hor-cookie-authentication/references/error-codes.md +24 -0
- package/dist/skills/hor-cookie-authentication/references/migrations.md +18 -0
- package/dist/skills/hor-cookie-authentication/references/resolvers.md +97 -0
- package/dist/skills/hor-cookie-authentication/references/session-clerk.md +41 -0
- package/dist/skills/hor-cookie-authentication/references/token-models.md +125 -0
- package/dist/skills/hor-database-design/SKILL.md +54 -0
- package/dist/skills/hor-database-design/references/column-types.md +92 -0
- package/dist/skills/hor-database-design/references/datetimes.md +88 -0
- package/dist/skills/hor-database-design/references/master-tables.md +117 -0
- package/dist/skills/hor-database-design/references/normalization.md +40 -0
- package/dist/skills/hor-database-design/references/update-history.md +35 -0
- package/dist/skills/hor-execution-placement-pattern/SKILL.md +216 -0
- package/dist/skills/hor-external-api-client/SKILL.md +99 -0
- package/dist/skills/hor-external-api-client/references/architecture.md +127 -0
- package/dist/skills/hor-external-api-client/references/authorization.md +105 -0
- package/dist/skills/hor-external-api-client/references/capsule.md +130 -0
- package/dist/skills/hor-external-api-client/references/conventions.md +68 -0
- package/dist/skills/hor-external-api-client/references/launcher.md +138 -0
- package/dist/skills/hor-external-api-client/references/payload.md +176 -0
- package/dist/skills/hor-external-api-client/references/sdk-wrapper.md +291 -0
- package/dist/skills/hor-external-api-client/references/testing.md +130 -0
- package/dist/skills/hor-external-api-client/references/usage.md +152 -0
- package/dist/skills/hor-graphql-schema/SKILL.md +360 -0
- package/dist/skills/hor-graphql-server-engine/SKILL.md +356 -0
- package/dist/skills/hor-light-rag/SKILL.md +242 -0
- package/dist/skills/hor-light-rag/references/retrieval-internals.md +143 -0
- package/dist/skills/hor-multi-llm-provider/SKILL.md +288 -0
- package/dist/skills/hor-multi-llm-provider/references/provider-internals.md +153 -0
- package/dist/skills/hor-mutation-resolver/SKILL.md +360 -0
- package/dist/skills/hor-mutation-resolver/references/dependency-injection.md +148 -0
- package/dist/skills/hor-mutation-resolver/references/errors.md +120 -0
- package/dist/skills/hor-mutation-resolver/references/resolve-flow.md +275 -0
- package/dist/skills/hor-mutation-resolver/references/testing.md +125 -0
- package/dist/skills/hor-mutation-resolver/references/transaction.md +197 -0
- package/dist/skills/hor-post-worker/SKILL.md +320 -0
- package/dist/skills/hor-query-resolver/SKILL.md +246 -0
- package/dist/skills/hor-query-resolver/references/anatomy.md +384 -0
- package/dist/skills/hor-query-resolver/references/data-access.md +248 -0
- package/dist/skills/hor-query-resolver/references/errors-and-context.md +172 -0
- package/dist/skills/hor-query-resolver/references/testing.md +241 -0
- package/dist/skills/hor-renchan-job-bullmq/SKILL.md +178 -0
- package/dist/skills/hor-renchan-job-bullmq/references/daemon-and-scheduler.md +182 -0
- package/dist/skills/hor-renchan-job-bullmq/references/engine-and-infra.md +106 -0
- package/dist/skills/hor-renchan-job-bullmq/references/job-triple.md +189 -0
- package/dist/skills/hor-renchan-job-bullmq/references/queues.md +74 -0
- package/dist/skills/hor-renchan-job-bullmq/references/subscriptions.md +113 -0
- package/dist/skills/hor-resolver-share/SKILL.md +262 -0
- package/dist/skills/hor-resolver-validator/SKILL.md +194 -0
- package/dist/skills/hor-resolver-validator/references/inspector-api.md +115 -0
- package/dist/skills/hor-resolver-validator/references/validator-pattern.md +281 -0
- package/dist/skills/hor-restfulapi-architecture/SKILL.md +275 -0
- package/dist/skills/hor-restfulapi-architecture/references/engine-and-context.md +192 -0
- package/dist/skills/hor-restfulapi-architecture/references/renderers.md +204 -0
- package/dist/skills/hor-restfulapi-architecture/references/response-and-flusher.md +118 -0
- package/dist/skills/hor-restfulapi-architecture/references/validation.md +229 -0
- package/dist/skills/hor-security-audit/SKILL.md +110 -0
- package/dist/skills/hor-security-audit/references/application-surface.md +90 -0
- package/dist/skills/hor-security-audit/references/auth-and-transport.md +147 -0
- package/dist/skills/hor-security-audit/references/code-safety.md +74 -0
- package/dist/skills/hor-security-audit/references/dependencies.md +72 -0
- package/dist/skills/hor-security-audit/references/network-and-logging.md +56 -0
- package/dist/skills/hor-security-audit/references/secrets.md +95 -0
- package/dist/skills/hor-sequelize-migration/SKILL.md +336 -0
- package/dist/skills/hor-sequelize-migration/references/alter-table.md +147 -0
- package/dist/skills/hor-sequelize-migration/references/foreign-keys.md +107 -0
- package/dist/skills/hor-sequelize-migration/references/indexes.md +149 -0
- package/dist/skills/hor-sequelize-migration/references/notation.md +215 -0
- package/dist/skills/hor-sequelize-model/SKILL.md +69 -0
- package/dist/skills/hor-sequelize-model/references/associations.md +218 -0
- package/dist/skills/hor-sequelize-model/references/default-methods.md +244 -0
- package/dist/skills/hor-sequelize-model/references/mixins.md +247 -0
- package/dist/skills/hor-sequelize-model/references/notation.md +225 -0
- package/dist/skills/hor-sequelize-model/references/timestamps.md +74 -0
- package/dist/skills/hor-sequelize-seeder/SKILL.md +275 -0
- package/dist/skills/hor-sequelize-seeder/references/development-coverage.md +74 -0
- package/dist/skills/hor-sequelize-seeder/references/directory-structure.md +113 -0
- package/dist/skills/hor-sequelize-seeder/references/id-numbering.md +133 -0
- package/dist/skills/hor-sequelize-seeder/references/naming.md +59 -0
- package/dist/skills/hor-sequelize-seeder/references/notation.md +170 -0
- package/dist/skills/hor-sequelize-subquery/SKILL.md +369 -0
- package/dist/skills/hor-strategy-pattern/SKILL.md +371 -0
- package/dist/skills/hor-stub-api/SKILL.md +330 -0
- package/dist/skills/hor-subscription-resolver/SKILL.md +105 -0
- package/dist/skills/hor-subscription-resolver/references/authentication.md +99 -0
- package/dist/skills/hor-subscription-resolver/references/basic-notation.md +116 -0
- package/dist/skills/hor-subscription-resolver/references/design-philosophy.md +68 -0
- package/dist/skills/hor-type-interface/SKILL.md +200 -0
- package/docs/skills.ja.md +40 -0
- package/docs/skills.md +40 -0
- package/lib/equip/CommandLineArguments.js +178 -0
- package/lib/equip/HoraSkillsCli.js +590 -0
- package/lib/equip/SkillsInstaller.js +443 -0
- package/lib/equip/SkillsManifestFile.js +260 -0
- package/lib/equip/constants/CLI_COMMAND.js +8 -0
- package/lib/equip/hora-skills-ort-renchan.js +8 -0
- package/package.json +51 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# The worker Daemon and the schedulers
|
|
2
|
+
|
|
3
|
+
Entry points: the worker Daemon (consumer) and the cron/interval scheduler registration. Referenced
|
|
4
|
+
from §3 and §6 of [SKILL.md](../SKILL.md). Draws on this repo's `scripts/` and the package's
|
|
5
|
+
`samples/confirm-01` (daemon) and `samples/confirm-02` (cron + interval schedulers).
|
|
6
|
+
|
|
7
|
+
## Worker Daemon
|
|
8
|
+
|
|
9
|
+
`JobWorkersDaemon` boots every `BaseJobWorker` subclass found under the engine's `workersPath`
|
|
10
|
+
(`DeepBulkClassLoader` scans recursively; a new job directory is picked up with no registration),
|
|
11
|
+
binds each to its Manifest's `jobName`, and installs SIGINT/SIGTERM graceful shutdown.
|
|
12
|
+
|
|
13
|
+
### Path A — simple (`createAsync`), no progress broker
|
|
14
|
+
|
|
15
|
+
The minimal form (the package `samples/confirm-01` shows this shape) is `createAsync` →
|
|
16
|
+
`startDaemon`:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import { JobWorkersDaemon } from '@openreachtech/renchan-job-bullmq'
|
|
20
|
+
import SampleJobEngine from '../app/SampleJobEngine.js'
|
|
21
|
+
|
|
22
|
+
// createAsync builds the engine and auto-discovers every BaseJobWorker under workersPath
|
|
23
|
+
const daemon = await JobWorkersDaemon.createAsync({
|
|
24
|
+
EngineCtor: SampleJobEngine,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
await daemon.startDaemon()
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Path B — with a progress broker (this repo)
|
|
31
|
+
|
|
32
|
+
When workers publish progress to a subscription, build the broker first and inject it into the
|
|
33
|
+
Engine, then create the daemon from that engine
|
|
34
|
+
(`scripts/startJobDaemon.js`):
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { SubscriptionBroker } from '@openreachtech/renchan'
|
|
38
|
+
import { JobWorkersDaemon } from '@openreachtech/renchan-job-bullmq'
|
|
39
|
+
import activate from '../sequelize/_.js'
|
|
40
|
+
import ContentGenerationJobEngine from '../app/ContentGenerationJobEngine.js'
|
|
41
|
+
import RedisConnection from '../app/queue/RedisConnection.js'
|
|
42
|
+
|
|
43
|
+
await activate() // Sequelize (workers touch the DB)
|
|
44
|
+
|
|
45
|
+
const subscriptionBroker = SubscriptionBroker.create({
|
|
46
|
+
config: {
|
|
47
|
+
redisOptions: RedisConnection.create().generatePubSubOptions(),
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const engine = await ContentGenerationJobEngine.createAsync({
|
|
52
|
+
subscriptionBroker,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const workerCtors = await JobWorkersDaemon.loadWorkerCtors({
|
|
56
|
+
engine,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
await JobWorkersDaemon
|
|
60
|
+
.create({
|
|
61
|
+
engine,
|
|
62
|
+
WorkerCtors: workerCtors,
|
|
63
|
+
})
|
|
64
|
+
.startDaemon()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- `startDaemon()` returns the started workers; it `setupWorker()`s each (creates the BullMQ `Worker`,
|
|
68
|
+
waits until ready, attaches the event sink) and attaches SIGINT/SIGTERM handlers that
|
|
69
|
+
`teardownWorker()` all workers (graceful `worker.close()`).
|
|
70
|
+
- Use **Path B** whenever a worker publishes progress; **Path A** otherwise.
|
|
71
|
+
|
|
72
|
+
## Cron and interval schedulers
|
|
73
|
+
|
|
74
|
+
A scheduler registers a **repeatable job** into Redis (via `queue.upsertJobScheduler`). There are two
|
|
75
|
+
concrete bases (both exported from the package):
|
|
76
|
+
|
|
77
|
+
| Base class | Schedule value object | `schedule` shape in `collectScheduleInputs` |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| `BaseCronJobScheduler` | `CronSchedule` | `{ cronExpression: '* * * * *' }` |
|
|
80
|
+
| `BaseIntervalJobScheduler` | `IntervalSchedule` | `{ millisecond: 10000, isImmediately: true }` |
|
|
81
|
+
|
|
82
|
+
A scheduler class declares `EngineCtor`, `ManifestCtor`, and `schedulerId`:
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import { BaseIntervalJobScheduler } from '@openreachtech/renchan-job-bullmq'
|
|
86
|
+
import SampleJobEngine from '../../SampleJobEngine.js'
|
|
87
|
+
import GammaJobManifest from './GammaJobManifest.js'
|
|
88
|
+
|
|
89
|
+
export default class GammaIntervalJobScheduler extends BaseIntervalJobScheduler {
|
|
90
|
+
/** @override */ static get EngineCtor () { return SampleJobEngine }
|
|
91
|
+
/** @override */ static get ManifestCtor () { return GammaJobManifest }
|
|
92
|
+
/** @override */ static get schedulerId () { return 'gamma-interval-scheduler' }
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
(Cron looks identical with `BaseCronJobScheduler`; see
|
|
97
|
+
`purge-expired-content-sessions`.) The
|
|
98
|
+
**Worker** for a scheduled job is a normal `BaseJobWorker` — the schedule only controls *when* a job
|
|
99
|
+
is enqueued.
|
|
100
|
+
|
|
101
|
+
### The scheduler service — one place listing every schedule
|
|
102
|
+
|
|
103
|
+
A `BaseJobSchedulerService` subclass returns the schedule inputs. **Each `schedulerId` must match its
|
|
104
|
+
scheduler class's `schedulerId`.**
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
import { BaseJobSchedulerService } from '@openreachtech/renchan-job-bullmq'
|
|
108
|
+
|
|
109
|
+
export default class SampleJobSchedulerService extends BaseJobSchedulerService {
|
|
110
|
+
/** @override */
|
|
111
|
+
static async collectScheduleInputs () {
|
|
112
|
+
return [
|
|
113
|
+
{
|
|
114
|
+
schedulerId: 'beta-cron-scheduler',
|
|
115
|
+
schedule: {
|
|
116
|
+
cronExpression: '* * * * *',
|
|
117
|
+
},
|
|
118
|
+
body: {
|
|
119
|
+
taskId: 1001,
|
|
120
|
+
message: 'cron heartbeat',
|
|
121
|
+
},
|
|
122
|
+
optionHash: {},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
schedulerId: 'gamma-interval-scheduler',
|
|
126
|
+
schedule: {
|
|
127
|
+
millisecond: 10000,
|
|
128
|
+
isImmediately: true,
|
|
129
|
+
},
|
|
130
|
+
body: {
|
|
131
|
+
batchId: 2001,
|
|
132
|
+
label: 'interval ping',
|
|
133
|
+
},
|
|
134
|
+
optionHash: {},
|
|
135
|
+
},
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Start / stop registration scripts (one-shot)
|
|
142
|
+
|
|
143
|
+
Registration is a **one-shot** script — it writes the repeatable-job definitions to Redis and exits;
|
|
144
|
+
the Daemon (separate, long-running process) consumes them.
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
// start-schedule.js — register every repeatable job, then exit (one-shot)
|
|
148
|
+
const service = await ContentGenerationJobSchedulerService.createAsync({
|
|
149
|
+
EngineCtor: ContentGenerationJobEngine,
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
await service.startAllSchedulers()
|
|
153
|
+
|
|
154
|
+
process.exit(0)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
// stop-schedule.js — remove every schedule, then exit
|
|
159
|
+
// (does NOT stop the Daemon; it only stops generating new jobs)
|
|
160
|
+
const service = await ContentGenerationJobSchedulerService.createAsync({
|
|
161
|
+
EngineCtor: ContentGenerationJobEngine,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
await service.stopAllSchedulers()
|
|
165
|
+
|
|
166
|
+
process.exit(0)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
- Await the call and exit — this is the module's intended shape, matching this repo's
|
|
170
|
+
`start-schedule.js`.
|
|
171
|
+
`ContentGenerationJobSchedulerService.js`
|
|
172
|
+
registers the hourly purge cron.
|
|
173
|
+
- Both calls return an array of response objects for optional inspection (start: `hasError()` /
|
|
174
|
+
`hasResponse()` / `jobName` / `createDispatchedAt()`; stop: `hasError()` / `schedulerId` /
|
|
175
|
+
`removed`). If you iterate them, use `for...of` / `map` / `filter` — **`forEach` is disallowed by
|
|
176
|
+
our eslint.**
|
|
177
|
+
|
|
178
|
+
## pm2 processes
|
|
179
|
+
|
|
180
|
+
`pm2.config.cjs` runs the two long-lived processes: **`GraphQL API`**
|
|
181
|
+
(`server/index.js`, the producer) and **`Job Daemon`** (`scripts/startJobDaemon.js`, the
|
|
182
|
+
consumer). Schedule registration is run on demand, not as a pm2 app.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Engine / Share / Context / RedisConnection
|
|
2
|
+
|
|
3
|
+
The shared infrastructure every job points at. Referenced from §2 of [SKILL.md](../SKILL.md).
|
|
4
|
+
|
|
5
|
+
## Engine — the one config object
|
|
6
|
+
|
|
7
|
+
A `BaseJobEngine` subclass (`app/ContentGenerationJobEngine.js`)
|
|
8
|
+
is the single place that names paths, Redis, the Share/Context constructors, error codes, and log
|
|
9
|
+
files. Every Dispatcher / Worker / Scheduler references it via `EngineCtor`.
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
export default class ContentGenerationJobEngine extends BaseJobEngine {
|
|
13
|
+
/** @override */
|
|
14
|
+
static get config () {
|
|
15
|
+
return {
|
|
16
|
+
workersPath: rootPath.to('app/jobs'), // Daemon scans here for BaseJobWorker subclasses
|
|
17
|
+
schedulersPath: rootPath.to('app/jobs'), // scheduler registration scans here
|
|
18
|
+
redisConfig: RedisConnection
|
|
19
|
+
.create()
|
|
20
|
+
.generateConnectionOptions(),
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @override */ static get ShareCtor () { return ContentGenerationJobShare }
|
|
25
|
+
/** @override */ static get ContextCtor () { return ContentGenerationJobContext }
|
|
26
|
+
|
|
27
|
+
/** @override */
|
|
28
|
+
static get standardErrorCodeHash () {
|
|
29
|
+
return {
|
|
30
|
+
Unknown: '100.X000.001',
|
|
31
|
+
InvalidRequest: '103.X000.001',
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @override */ static get savingLogFilePath () { return rootPath.to('logs/content-generation-job.log') }
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **`config`** returns `{ workersPath, schedulersPath, redisConfig }`. Both paths point at `app/jobs`
|
|
40
|
+
(the Daemon and scheduler-registration scan there).
|
|
41
|
+
- **`savingLogFilePath`** is the default per-job log file; **`savingLogFilePathLookup`** (optional) can
|
|
42
|
+
map specific `jobName`s to their own files.
|
|
43
|
+
- **`createAsync({ subscriptionBroker })`** builds the Share, injecting the progress broker (see
|
|
44
|
+
[subscriptions.md](./subscriptions.md)). Enqueue-only callers omit it (broker stays `null`).
|
|
45
|
+
- The engine exposes `buildDispatcherConfig()` / `buildSchedulerConfig()` / `buildWorkerConfig()`
|
|
46
|
+
(all reading `redisConfig`), an `Error` hash built from `standardErrorCodeHash`, and per-role
|
|
47
|
+
logger pools.
|
|
48
|
+
|
|
49
|
+
## Share — per-process shared bag
|
|
50
|
+
|
|
51
|
+
`BaseJobShare` subclass (`app/contexts/ContentGenerationJobShare.js`).
|
|
52
|
+
Created once per process by the engine; holds `processClerk`, `env`, `timber`, and (when injected)
|
|
53
|
+
the `subscriptionBroker`. The getter just returns the stored instance — no side effects. Enqueue-only
|
|
54
|
+
processes construct the Share with `subscriptionBroker: null`.
|
|
55
|
+
|
|
56
|
+
## Context — per-job DI object
|
|
57
|
+
|
|
58
|
+
`BaseJobContext` subclass. Created fresh for **each job execution** (`createAsync({ engine })`) and
|
|
59
|
+
handed to `executeJob` as `context`. Put per-job dependency resolution here (loaders, resolvers) so
|
|
60
|
+
the worker stays thin.
|
|
61
|
+
|
|
62
|
+
## RedisConnection — one Redis, two option shapes
|
|
63
|
+
|
|
64
|
+
`app/queue/RedisConnection.js` reads `REDIS_HOST` /
|
|
65
|
+
`REDIS_PORT` / `REDIS_PASSWORD` and produces:
|
|
66
|
+
|
|
67
|
+
- **`generateConnectionOptions()`** — for BullMQ queues/workers. **Must include
|
|
68
|
+
`maxRetriesPerRequest: null`** (BullMQ requirement).
|
|
69
|
+
- **`generatePubSubOptions()`** — for the subscription broker (no `maxRetriesPerRequest`).
|
|
70
|
+
|
|
71
|
+
The **GraphQL API process and the Job Daemon must point at the same Redis** — that shared instance is
|
|
72
|
+
both the job queue and the progress-PubSub channel.
|
|
73
|
+
|
|
74
|
+
## Connections are established once, never per job
|
|
75
|
+
|
|
76
|
+
Both the subscription broker and each worker's Redis connection are established **once at Daemon
|
|
77
|
+
startup** and reused for the process's lifetime — never re-created inside a worker per job:
|
|
78
|
+
|
|
79
|
+
- The **subscription broker** is built once in the daemon entry script and injected via
|
|
80
|
+
`Engine.createAsync({ subscriptionBroker })` → held on the Share. A worker only reads it
|
|
81
|
+
(`this.subscriptionBroker`); it never constructs one. Enqueue-only processes inject none (`null`).
|
|
82
|
+
- Each **worker's BullMQ connection** is opened once when `JobWorkersDaemon.startDaemon()` builds and
|
|
83
|
+
`setupWorker()`s the workers; the BullMQ `Worker` is a long-lived consumer. `executeJob` runs per
|
|
84
|
+
job but reuses that open connection.
|
|
85
|
+
- On the **producer side**, `JobDispatcherProvider` plays the same role — it caches one dispatcher
|
|
86
|
+
(queue producer connection) per `DispatcherCtor` and reuses it (`keepsConnection: true`), tearing
|
|
87
|
+
down only at process exit. So do **not** `createAsync()` a fresh dispatcher per request.
|
|
88
|
+
|
|
89
|
+
This "connect once at boot, reuse per job" model is the framework's intended design.
|
|
90
|
+
|
|
91
|
+
## Package exports (quick reference)
|
|
92
|
+
|
|
93
|
+
`@openreachtech/renchan-job-bullmq` exports, among others:
|
|
94
|
+
|
|
95
|
+
| Export | Role |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `BaseJobEngine` | central config |
|
|
98
|
+
| `BaseJobManifest` | queue name + body schema |
|
|
99
|
+
| `BaseJobWorker` | consumer |
|
|
100
|
+
| `BaseJobDispatcher` | producer |
|
|
101
|
+
| `BaseJobScheduler` / `BaseCronJobScheduler` / `BaseIntervalJobScheduler` | schedulers |
|
|
102
|
+
| `BaseJobSchedulerService` | schedule registration service |
|
|
103
|
+
| `BaseJobContext` / `BaseJobShare` | per-job / per-process DI |
|
|
104
|
+
| `JobWorkersDaemon` | worker daemon |
|
|
105
|
+
| `CronSchedule` / `IntervalSchedule` / `BaseSchedule` | schedule value objects |
|
|
106
|
+
| `JobBody`, `RenchanJobError`, `DeepBulkClassLoader`, `ProcessClerk`, `Timber` | tools |
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# The job triple (Manifest / Worker / Dispatcher)
|
|
2
|
+
|
|
3
|
+
The per-job files and how they fit together. Referenced from §1 of [SKILL.md](../SKILL.md). Examples
|
|
4
|
+
draw on both this repo (`app/jobs/**`) and the package's own `samples/confirm-01`.
|
|
5
|
+
|
|
6
|
+
## Directory layout
|
|
7
|
+
|
|
8
|
+
One job = one directory `app/jobs/<kebab-job-name>/` holding:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
app/jobs/send-report-email/
|
|
12
|
+
├── SendReportEmailJobManifest.js # queue name + body schema
|
|
13
|
+
├── SendReportEmailJobWorker.js # consume: executeJob + hooks
|
|
14
|
+
├── SendReportEmailJobDispatcher.js # produce: enqueue + queue options
|
|
15
|
+
└── .keepDirectory.js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- The directory name is kebab-case and **equals the `jobName`** (the BullMQ queue name).
|
|
19
|
+
- Classes are PascalCase with the fixed suffixes `JobManifest` / `JobWorker` / `JobDispatcher` (and
|
|
20
|
+
`CronJobScheduler` / `IntervalJobScheduler` for scheduled jobs —
|
|
21
|
+
[daemon-and-scheduler.md](./daemon-and-scheduler.md)).
|
|
22
|
+
|
|
23
|
+
## Manifest — queue name + body schema
|
|
24
|
+
|
|
25
|
+
`BaseJobManifest` subclass. `jobName` is the single source of truth for the queue name; `bodySchema`
|
|
26
|
+
validates the enqueue payload. Scalars come from `ScalarHash` (`Text` / `Integer` / …) of
|
|
27
|
+
`@openreachtech/mentsu-schema`.
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { BaseJobManifest } from '@openreachtech/renchan-job-bullmq'
|
|
31
|
+
import { ScalarHash } from '@openreachtech/mentsu-schema'
|
|
32
|
+
|
|
33
|
+
const { Integer, Text } = ScalarHash
|
|
34
|
+
|
|
35
|
+
export default class ContentGenerationPublicLpJobManifest extends BaseJobManifest {
|
|
36
|
+
/** @override */ static get jobName () { return 'content-generation-public-lp' }
|
|
37
|
+
|
|
38
|
+
/** @override */
|
|
39
|
+
static get bodySchema () {
|
|
40
|
+
return {
|
|
41
|
+
jobId: Integer,
|
|
42
|
+
accessToken: Text,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- The body is normalized/denormalized by the framework for Redis transport, so it may carry rich
|
|
49
|
+
values (e.g. `Date`, `BigNumber` — see `samples/confirm-01`'s alpha body), not just primitives.
|
|
50
|
+
Keep the body **minimal** — usually just ids/tokens; load the full row from the DB in the worker.
|
|
51
|
+
|
|
52
|
+
## Worker — executeJob + lifecycle hooks
|
|
53
|
+
|
|
54
|
+
`BaseJobWorker` subclass. Point `ManifestCtor` at the Manifest and implement `executeJob`. The four
|
|
55
|
+
lifecycle hooks are **abstract** and must be implemented; use `this.timber` for console logging and
|
|
56
|
+
`this.ensureLogger()` for the per-job file logger.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { BaseJobWorker } from '@openreachtech/renchan-job-bullmq'
|
|
60
|
+
import AlphaJobManifest from './AlphaJobManifest.js'
|
|
61
|
+
|
|
62
|
+
export default class AlphaJobWorker extends BaseJobWorker {
|
|
63
|
+
/** @override */ static get ManifestCtor () { return AlphaJobManifest }
|
|
64
|
+
|
|
65
|
+
/** @override */
|
|
66
|
+
async executeJob ({
|
|
67
|
+
body,
|
|
68
|
+
context,
|
|
69
|
+
parcel,
|
|
70
|
+
}) {
|
|
71
|
+
this.timber.log(`[${this.Ctor.jobName}] started with body:`, body)
|
|
72
|
+
|
|
73
|
+
// ... the work ...
|
|
74
|
+
|
|
75
|
+
// WARNING: the return value is stored in Redis. Return only the minimum necessary —
|
|
76
|
+
// never arrays of entities / large blobs (memory pressure + instability).
|
|
77
|
+
return {
|
|
78
|
+
executedAt: new Date().toISOString(),
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Implement the four lifecycle hooks too (return null for a fire-and-forget job):
|
|
83
|
+
// onJobCompleted / onJobFailed / onJobProgress / onWorkerError
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- **`executeJob({ body, context, parcel })`** — `body` is the validated, normalized payload;
|
|
88
|
+
`context` is the per-job DI object (Context); `parcel` wraps the BullMQ job (`parcel.jobModel.job`
|
|
89
|
+
for `updateProgress`, token, abort signal).
|
|
90
|
+
- **Return value is persisted in Redis** — keep it tiny.
|
|
91
|
+
- **`buildOptionHash()`** overrides BullMQ `WorkerOptions`; spread `super.buildOptionHash()` (which
|
|
92
|
+
supplies `connection`) and add `concurrency` / `limiter`:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
/** @override */
|
|
96
|
+
buildOptionHash () {
|
|
97
|
+
return {
|
|
98
|
+
...super.buildOptionHash(),
|
|
99
|
+
|
|
100
|
+
concurrency: 5,
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Lifecycle hooks fire per BullMQ event. For a fire-and-forget job, return `null` from each. To
|
|
106
|
+
publish progress to a subscription, override `onJobProgress` (see
|
|
107
|
+
[subscriptions.md](./subscriptions.md)).
|
|
108
|
+
|
|
109
|
+
## Dispatcher — enqueue + per-queue options
|
|
110
|
+
|
|
111
|
+
`BaseJobDispatcher` subclass. It needs `EngineCtor` (which Engine/Redis to use) and `ManifestCtor`.
|
|
112
|
+
`static optionHash` sets BullMQ `QueueOptions` (producer defaults such as `attempts`).
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
import { BaseJobDispatcher } from '@openreachtech/renchan-job-bullmq'
|
|
116
|
+
import ContentGenerationJobEngine from '../../ContentGenerationJobEngine.js'
|
|
117
|
+
import SendReportEmailJobManifest from './SendReportEmailJobManifest.js'
|
|
118
|
+
|
|
119
|
+
export default class SendReportEmailJobDispatcher extends BaseJobDispatcher {
|
|
120
|
+
/** @override */ static get EngineCtor () { return ContentGenerationJobEngine }
|
|
121
|
+
/** @override */ static get ManifestCtor () { return SendReportEmailJobManifest }
|
|
122
|
+
|
|
123
|
+
/** @override */
|
|
124
|
+
static get optionHash () {
|
|
125
|
+
return {
|
|
126
|
+
defaultJobOptions: {
|
|
127
|
+
attempts: 3,
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### DRY: a base app dispatcher
|
|
135
|
+
|
|
136
|
+
When several dispatchers share one Engine, define a base app dispatcher that sets `EngineCtor` once,
|
|
137
|
+
and let each job dispatcher set only `ManifestCtor` (this is what `samples/confirm-01` does):
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
// SampleBaseAppJobDispatcher.js
|
|
141
|
+
export default class SampleBaseAppJobDispatcher extends BaseJobDispatcher {
|
|
142
|
+
/** @override */ static get EngineCtor () { return SampleJobEngine }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// jobs/alpha/AlphaJobDispatcher.js
|
|
146
|
+
export default class AlphaJobDispatcher extends SampleBaseAppJobDispatcher {
|
|
147
|
+
/** @override */ static get ManifestCtor () { return AlphaJobManifest }
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Enqueuing
|
|
152
|
+
|
|
153
|
+
**From a resolver** — use the request-scope `JobDispatcherProvider` (connection reuse; see
|
|
154
|
+
[engine-and-infra.md](./engine-and-infra.md)):
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
await context.share.jobDispatcherProvider.dispatchJob({
|
|
158
|
+
DispatcherCtor: SendReportEmailJobDispatcher,
|
|
159
|
+
body: {
|
|
160
|
+
sessionToken,
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Standalone (one-off script)** — self-boot, dispatch, inspect the response, tear down:
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
const dispatcher = await AlphaJobDispatcher.createAsync()
|
|
169
|
+
|
|
170
|
+
const response = await dispatcher.dispatchJob({
|
|
171
|
+
body: {
|
|
172
|
+
// ...
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
if (response.hasError()) {
|
|
177
|
+
// response.errorMessage
|
|
178
|
+
}
|
|
179
|
+
if (response.hasResponse()) {
|
|
180
|
+
// response.createDispatchedAt() → Date the job was enqueued
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
await dispatcher.teardown()
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- `dispatchJob({ body })` validates `body` against the Manifest schema, `queue.add`s, and returns a
|
|
187
|
+
**DispatcherResponse** (`hasError()` / `errorMessage` / `hasResponse()` / `createDispatchedAt()`).
|
|
188
|
+
It auto-`teardown()`s the queue connection unless `keepsConnection: true` is passed (the provider
|
|
189
|
+
passes `true` to reuse the connection).
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Splitting queues
|
|
2
|
+
|
|
3
|
+
How to run work across multiple queues, share worker logic safely, and scale queues independently.
|
|
4
|
+
Referenced from §5 of [SKILL.md](../SKILL.md).
|
|
5
|
+
|
|
6
|
+
## One queue == one job directory == one Manifest `jobName`
|
|
7
|
+
|
|
8
|
+
To add a queue, add a job directory whose Manifest returns a new `jobName`
|
|
9
|
+
([job-triple.md](./job-triple.md)). The Daemon discovers and listens on every queue whose worker
|
|
10
|
+
lives under `workersPath`; on boot it logs one `Listening: <jobName>` per queue.
|
|
11
|
+
|
|
12
|
+
This repo splits the *same* content-generation work into two queues so they can be secured, scaled, and
|
|
13
|
+
subscribed-to independently:
|
|
14
|
+
|
|
15
|
+
| Queue (`jobName`) | Body | Enqueued from | Progress scope |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| `content-generation-internal` | `{ jobId }` | admin GraphQL + integration REST | `jobId` (no subscription) |
|
|
18
|
+
| `content-generation-public-lp` | `{ jobId, accessToken }` | public LP GraphQL | `accessToken` (customer subscription) |
|
|
19
|
+
|
|
20
|
+
Both are enqueued the same way, just with a different `DispatcherCtor`:
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// public LP resolver
|
|
24
|
+
await context.share.jobDispatcherProvider.dispatchJob({
|
|
25
|
+
DispatcherCtor: ContentGenerationPublicLpJobDispatcher,
|
|
26
|
+
body: {
|
|
27
|
+
jobId,
|
|
28
|
+
accessToken,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// admin / integration
|
|
33
|
+
await context.share.jobDispatcherProvider.dispatchJob({
|
|
34
|
+
DispatcherCtor: ContentGenerationInternalJobDispatcher,
|
|
35
|
+
body: {
|
|
36
|
+
jobId,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Share logic with a base worker — but place it OUTSIDE `workersPath`
|
|
42
|
+
|
|
43
|
+
Both workers `extends BaseContentGenerationJobWorker` (the app base) and differ only in
|
|
44
|
+
`ManifestCtor` — so the queues share all the real logic.
|
|
45
|
+
|
|
46
|
+
- **Gotcha:** that shared abstract base lives in `app/` — **outside `workersPath` (`app/jobs`)**. The
|
|
47
|
+
Daemon's `DeepBulkClassLoader` boots *every* `BaseJobWorker` subclass found under `workersPath`, and
|
|
48
|
+
an abstract base has no `jobName`, so leaving it under `app/jobs/**` would crash daemon startup.
|
|
49
|
+
**Keep only concrete workers under `app/jobs/**`; put shared bases elsewhere in `app/`.**
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
app/
|
|
53
|
+
├── BaseContentGenerationJobWorker.js # shared base — NOT under app/jobs
|
|
54
|
+
└── jobs/
|
|
55
|
+
├── content-generation-internal/ContentGenerationInternalJobWorker.js # concrete
|
|
56
|
+
└── content-generation-public-lp/ContentGenerationPublicLpJobWorker.js # concrete
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Run a subset of queues per Daemon (`skipJobHash`)
|
|
60
|
+
|
|
61
|
+
One Daemon process listens on all discovered queues by default. To run a **subset** per process — e.g.
|
|
62
|
+
put a heavy queue on its own machine — the engine/daemon supports a `skipJobHash`
|
|
63
|
+
(`{ [jobName]: true }`) that filters those worker constructors out at boot. Start one Daemon that
|
|
64
|
+
skips the heavy queue and another that runs only it, both against the same Redis.
|
|
65
|
+
|
|
66
|
+
## Tune each queue independently
|
|
67
|
+
|
|
68
|
+
- **Producer defaults** — the Dispatcher's `static optionHash` (BullMQ `QueueOptions`), e.g.
|
|
69
|
+
`defaultJobOptions: { attempts: 3 }`.
|
|
70
|
+
- **Consumer throughput** — the Worker's `buildOptionHash()` (BullMQ `WorkerOptions`), e.g.
|
|
71
|
+
`concurrency` and `limiter` (rate limiting; see `app/tools/ContentGenerationRateLimiter.js`).
|
|
72
|
+
|
|
73
|
+
Because these are per class, two queues that share a base worker can still carry different
|
|
74
|
+
concurrency / attempts / limiter settings.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Integrating with subscriptions (progress → GraphQL)
|
|
2
|
+
|
|
3
|
+
How a worker in the Job Daemon streams progress to a GraphQL subscription in the API process, over
|
|
4
|
+
the shared Redis PubSub broker. Referenced from §4 of [SKILL.md](../SKILL.md).
|
|
5
|
+
|
|
6
|
+
## The two sides
|
|
7
|
+
|
|
8
|
+
- **Publisher** = a worker in the **Job Daemon** process.
|
|
9
|
+
- **Subscriber** = a GraphQL subscription resolver in the **GraphQL API** process.
|
|
10
|
+
- **Transport** = one `SubscriptionBroker` (Redis PubSub) that both processes point at (same Redis as
|
|
11
|
+
the queues — [engine-and-infra.md](./engine-and-infra.md)).
|
|
12
|
+
|
|
13
|
+
A message is delivered by matching **channel** + **scope**. Scope namespaces the channel so a given
|
|
14
|
+
customer only receives their own job's progress.
|
|
15
|
+
|
|
16
|
+
## Publish side (worker)
|
|
17
|
+
|
|
18
|
+
The Daemon builds the broker and injects it into the Engine
|
|
19
|
+
([daemon-and-scheduler.md](./daemon-and-scheduler.md#path-b--with-a-progress-broker-this-repo)); the
|
|
20
|
+
Share then exposes it. Enqueue-only processes never inject a broker, so `subscriptionBroker` is
|
|
21
|
+
`null` and publishing is a no-op.
|
|
22
|
+
|
|
23
|
+
For AI jobs, `BaseAgentJobWorker` (from `@openreachtech/mentsu-agent-loop-renchan-job`) already turns
|
|
24
|
+
the lifecycle hooks into publishes: `onJobProgress` → `publishProgress({ topic, event })`,
|
|
25
|
+
`onJobCompleted` → `{ phase: 'done', payload: result }`, `onJobFailed` → an error event. It builds the
|
|
26
|
+
`topic` from `channel` + `buildScope({ jobModel })`.
|
|
27
|
+
|
|
28
|
+
This repo's app base `BaseContentGenerationJobWorker.js`
|
|
29
|
+
customizes it:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
/** @override */
|
|
33
|
+
get channel () {
|
|
34
|
+
return 'reportProgress' // must equal the subscription resolver's channel
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @override */
|
|
38
|
+
buildScope ({
|
|
39
|
+
jobModel,
|
|
40
|
+
}) {
|
|
41
|
+
const body = jobModel.denormalizedBody
|
|
42
|
+
|
|
43
|
+
// public-lp jobs scope by accessToken (the customer's key); internal jobs fall back to jobId
|
|
44
|
+
if (body.accessToken) {
|
|
45
|
+
return {
|
|
46
|
+
accessToken: body.accessToken,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
jobId: body.jobId,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @override */
|
|
56
|
+
publishProgress ({
|
|
57
|
+
topic,
|
|
58
|
+
event,
|
|
59
|
+
}) {
|
|
60
|
+
if (!this.subscriptionBroker) {
|
|
61
|
+
return null // enqueue-only process: no broker, no publish
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// adapt to renchan SubscriptionBroker's { channel, message } signature
|
|
65
|
+
return this.subscriptionBroker.publish({
|
|
66
|
+
channel: topic,
|
|
67
|
+
message: event,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
(It also persists progress / result / failure to the DB inside the overridden `onJob*` hooks, then
|
|
73
|
+
calls `super` to publish.)
|
|
74
|
+
|
|
75
|
+
## Subscribe side (GraphQL)
|
|
76
|
+
|
|
77
|
+
The GraphQL server resolves the subscription with a **matching channel and scope**
|
|
78
|
+
(`OnReportProgressSubscriptionResolver.js`):
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
export default class OnReportProgressSubscriptionResolver extends BaseAgentProgressSubscriptionResolver {
|
|
82
|
+
/** @override */ static get schema () { return 'onReportProgress' }
|
|
83
|
+
|
|
84
|
+
/** @override */
|
|
85
|
+
get channel () {
|
|
86
|
+
return 'reportProgress' // matches the worker's channel
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** @override */
|
|
90
|
+
generateChannelQuery ({
|
|
91
|
+
variables,
|
|
92
|
+
}) {
|
|
93
|
+
// matches the worker's buildScope
|
|
94
|
+
return {
|
|
95
|
+
accessToken: variables.input.accessToken,
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @override */
|
|
100
|
+
resolve (payload) {
|
|
101
|
+
return payload // forward the worker's raw progress event
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Checklist
|
|
107
|
+
|
|
108
|
+
- **Channel string identical** on both sides (`'reportProgress'`).
|
|
109
|
+
- **Scope keys identical** on both sides (`{ accessToken }`) — this is why the public-lp queue body
|
|
110
|
+
carries `accessToken` ([queues.md](./queues.md)).
|
|
111
|
+
- **Same Redis** for the Daemon's broker and the API's broker.
|
|
112
|
+
- **Daemon injects the broker** (Path B); the enqueue path does not (publish becomes a no-op).
|
|
113
|
+
- After a `done` / `error` event, the client typically re-queries for the final persisted result.
|