Skip to content

Commit 17329ff

Browse files
durable-workflow.github.io: update v2 changes
1 parent 68e5e6b commit 17329ff

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/configuration/options.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,37 @@ Use `php artisan workflow:v2:repair-pass` to run one operator-triggered sweep wi
236236

237237
Use `operator_metrics.repair.scopes[*]` when a shared workflow database has several queues or worker fleets. Each scope reports its existing-task candidates, missing-task run candidates, total candidates, selected task/run candidates for the next pass, oldest task age, oldest missing-run age, and whether that scope is affected by the global scan limit on the current snapshot. Treat `scan_pressure = true`, a hot scope with steadily growing candidate age, or a scope that never drains as a signal to increase `scan_limit`, add workers for that queue, or fix the underlying queue/backend issue before the repair backlog ages out of sight.
238238

239+
## Task Dispatch Mode
240+
241+
By default, the engine pushes every ready task onto the Laravel queue so that `queue:work` processes pick them up. In a standalone server deployment where no workflow or activity PHP classes are registered locally, set `task_dispatch_mode` to `poll` so that tasks are only persisted as ready rows and left for external workers to discover through the task bridges.
242+
243+
```env
244+
WORKFLOW_V2_TASK_DISPATCH_MODE=poll
245+
```
246+
247+
Or in `config/workflows.php`:
248+
249+
```php
250+
'v2' => [
251+
'task_dispatch_mode' => env('WORKFLOW_V2_TASK_DISPATCH_MODE', 'queue'),
252+
// ...
253+
],
254+
```
255+
256+
| Mode | Behavior |
257+
|------|----------|
258+
| `queue` (default) | Tasks are dispatched to the Laravel queue via `Bus::dispatch()`. Internal `queue:work` processes claim and execute them. |
259+
| `poll` | Tasks stay in `ready` status without a queue job. External workers discover them through `WorkflowTaskBridge::poll()` and `ActivityTaskBridge::poll()`. |
260+
261+
In poll mode, `TaskDispatcher` records a successful dispatch timestamp so the task repair sweep does not treat the task as stuck, but no queue job is created. The task row is the sole delivery mechanism; external workers poll, claim, execute (or replay and complete), and the engine advances the workflow.
262+
263+
Use poll mode when:
264+
- The standalone server hosts the durable database but no workflow PHP classes.
265+
- External workers (in another Laravel app or a language-neutral worker) handle replay.
266+
- You want to avoid the internal `queue:work` process touching workflow or activity tasks.
267+
268+
Embedded deployments where the same Laravel app contains both the workflow classes and the queue worker should keep the default `queue` mode.
269+
239270
## Backend Capability Check
240271

241272
Use the doctor command to check the configured runtime substrate before deploying workers:

0 commit comments

Comments
 (0)