You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/world-postgres/HOW_IT_WORKS.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,14 @@ If you want to use any other ORM, query builder or underlying database client, y
12
12
graph LR
13
13
Client --> PG[graphile-worker queue]
14
14
PG --> Worker[Embedded Worker]
15
-
Worker --> HTTP[HTTP fetch]
16
-
HTTP --> EW[Local World]
15
+
Worker --> Exec[Queue Executor]
16
+
Exec --> Handler[Workflow or Step Handler]
17
17
18
18
PG -.-> F["${prefix}flows<br/>(workflows)"]
19
19
PG -.-> S["${prefix}steps<br/>(steps)"]
20
20
```
21
21
22
-
Jobs include retry logic (3 attempts), idempotency keys, and configurable worker concurrency (default: 10).
22
+
Jobs include retry logic (3 attempts), idempotency keys, durable delayed rescheduling, and configurable worker concurrency (default: 10).
23
23
24
24
## Streaming
25
25
@@ -33,7 +33,12 @@ Real-time data streaming via **PostgreSQL LISTEN/NOTIFY**:
33
33
34
34
## Setup
35
35
36
-
Call `world.start()` to initialize graphile-worker workers. When `.start()` is called, workers begin listening to graphile-worker queues. When a job arrives, workers make HTTP fetch calls to the local world endpoints (`.well-known/workflow/v1/flow` or `.well-known/workflow/v1/step`) to execute the actual workflow logic.
36
+
Call `world.start()` to initialize graphile-worker workers. When `.start()` is called, workers begin listening to graphile-worker queues. When a job arrives, the worker executes the queue message directly through the shared queue executor and awaits completion before acknowledging the Graphile job.
37
+
38
+
When the runtime returns `{ timeoutSeconds }`, the worker schedules a new Graphile job with a future `runAt` time before finishing the current task.
39
+
40
+
The executor still falls back to the HTTP-compatible workflow endpoints (`.well-known/workflow/v1/flow` or `.well-known/workflow/v1/step`) when the route module has not been loaded yet.
41
+
37
42
38
43
In **Next.js**, the `world.start()` call needs to be added to `instrumentation.ts|js` to ensure workers start before request handling. Use `workflow/runtime` for `getWorld` (same as the testing server and other framework plugins):
0 commit comments