Skip to content

Commit 719a689

Browse files
deploy: 968595a
1 parent 05c19a0 commit 719a689

168 files changed

Lines changed: 329 additions & 685 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2.0/llms-full.txt

Lines changed: 0 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -6475,184 +6475,6 @@ php artisan queue:work shared --queue=activities
64756475

64766476
App A's worker replays workflows and schedules activity tasks. App B's worker picks up those activity tasks, executes them, and returns results. The engine handles the handoff through the shared database.
64776477

6478-
## Activity Task Bridge
6479-
6480-
The `ActivityTaskBridge` contract lets an app poll for, claim, and complete activity tasks.
6481-
6482-
```php
6483-
use Workflow\V2\Contracts\ActivityTaskBridge;
6484-
6485-
$bridge = app(ActivityTaskBridge::class);
6486-
```
6487-
6488-
### Poll, claim, complete
6489-
6490-
```php
6491-
// Find ready activity tasks
6492-
$tasks = $bridge->poll('shared', 'activities', limit: 10);
6493-
6494-
// Claim a task (5-minute lease)
6495-
$claim = $bridge->claim($taskId, 'worker-1');
6496-
// $claim['activity_type'], $claim['arguments'], $claim['payload_codec']
6497-
6498-
// Complete with a result
6499-
$bridge->complete($claim['activity_attempt_id'], ['confirmation' => 'captured']);
6500-
6501-
// Or fail
6502-
$bridge->fail($claim['activity_attempt_id'], 'Gateway timeout');
6503-
```
6504-
6505-
### Heartbeat
6506-
6507-
Long-running activities extend their lease and check for cancellation:
6508-
6509-
```php
6510-
$hb = $bridge->heartbeat($claim['activity_attempt_id']);
6511-
6512-
if (! $hb['can_continue']) {
6513-
// Run was cancelled or terminated — stop work
6514-
return;
6515-
}
6516-
```
6517-
6518-
### HTTP routes
6519-
6520-
The bridge is also available as HTTP endpoints through `Workflow\V2\Webhooks::routes(...)`:
6521-
6522-
```
6523-
GET /webhooks/activity-tasks/poll
6524-
POST /webhooks/activity-tasks/{taskId}/claim
6525-
POST /webhooks/activity-attempts/{attemptId}/heartbeat
6526-
POST /webhooks/activity-attempts/{attemptId}/complete
6527-
POST /webhooks/activity-attempts/{attemptId}/fail
6528-
```
6529-
6530-
## Workflow Task Bridge
6531-
6532-
The `WorkflowTaskBridge` contract lets an app poll for, claim, replay, and complete workflow tasks.
6533-
6534-
```php
6535-
use Workflow\V2\Contracts\WorkflowTaskBridge;
6536-
6537-
$bridge = app(WorkflowTaskBridge::class);
6538-
```
6539-
6540-
### Poll and claim
6541-
6542-
```php
6543-
$tasks = $bridge->poll('shared', 'workflows', limit: 10);
6544-
$claim = $bridge->claim($taskId, 'worker-1');
6545-
```
6546-
6547-
### Execute in-process
6548-
6549-
The recommended path when the app has the workflow package and classes:
6550-
6551-
```php
6552-
$result = $bridge->execute($taskId);
6553-
// $result['run_status'], $result['next_task_id']
6554-
```
6555-
6556-
### External completion
6557-
6558-
When replay happens outside the package, submit commands directly:
6559-
6560-
```php
6561-
use Workflow\Serializers\Serializer;
6562-
6563-
$result = $bridge->complete($taskId, [
6564-
[
6565-
'type' => 'schedule_activity',
6566-
'activity_type' => 'send-email',
6567-
'arguments' => Serializer::serializeWithCodec('avro', ['user@example.com']),
6568-
],
6569-
]);
6570-
6571-
// Terminal command
6572-
$result = $bridge->complete($taskId, [
6573-
[
6574-
'type' => 'complete_workflow',
6575-
'result' => Serializer::serializeWithCodec('avro', ['done' => true]),
6576-
],
6577-
]);
6578-
```
6579-
6580-
Commands:
6581-
6582-
| Type | Fields | Terminal |
6583-
|------|--------|---------|
6584-
| `schedule_activity` | `activity_type`, `arguments`, `connection`, `queue` | No |
6585-
| `start_timer` | `delay_seconds` | No |
6586-
| `start_child_workflow` | `workflow_type`, `arguments`, `connection`, `queue` | No |
6587-
| `complete_workflow` | `result` | Yes |
6588-
| `fail_workflow` | `message` | Yes |
6589-
| `continue_as_new` | `arguments`, `workflow_type` | Yes |
6590-
6591-
### HTTP routes
6592-
6593-
```
6594-
GET /webhooks/workflow-tasks/poll
6595-
POST /webhooks/workflow-tasks/{taskId}/claim
6596-
GET /webhooks/workflow-tasks/{taskId}/history
6597-
POST /webhooks/workflow-tasks/{taskId}/execute
6598-
POST /webhooks/workflow-tasks/{taskId}/complete
6599-
POST /webhooks/workflow-tasks/{taskId}/fail
6600-
POST /webhooks/workflow-tasks/{taskId}/heartbeat
6601-
```
6602-
6603-
## Control Plane
6604-
6605-
The `WorkflowControlPlane` contract starts, signals, queries, updates, cancels, and terminates workflows using type keys.
6606-
6607-
```php
6608-
use Workflow\V2\Contracts\WorkflowControlPlane;
6609-
6610-
$cp = app(WorkflowControlPlane::class);
6611-
```
6612-
6613-
### Start
6614-
6615-
```php
6616-
$result = $cp->start('order-processing', 'order-12345', [
6617-
'arguments' => Serializer::serializeWithCodec('avro', ['item_count' => 3]),
6618-
'connection' => 'shared',
6619-
'queue' => 'workflows',
6620-
]);
6621-
// $result['workflow_instance_id'], $result['workflow_run_id']
6622-
```
6623-
6624-
### Signal, query, update
6625-
6626-
```php
6627-
$cp->signal('order-12345', 'addItem', ['arguments' => ['SKU-789']]);
6628-
6629-
$result = $cp->query('order-12345', 'getTotal');
6630-
6631-
$result = $cp->update('order-12345', 'setAddress', ['arguments' => ['123 Main St']]);
6632-
```
6633-
6634-
### Cancel, terminate, repair, archive
6635-
6636-
```php
6637-
$cp->cancel('order-12345', ['reason' => 'Customer request']);
6638-
$cp->terminate('order-12345', ['reason' => 'Fraud detected']);
6639-
$cp->repair('order-12345');
6640-
$cp->archive('order-12345');
6641-
```
6642-
6643-
### Describe
6644-
6645-
```php
6646-
$result = $cp->describe('order-12345');
6647-
// $result['status'], $result['run'], $result['actions']
6648-
```
6649-
6650-
### HTTP route
6651-
6652-
```
6653-
POST /webhooks/control-plane/start
6654-
```
6655-
66566478
# Pruning Workflows
66576479

66586480
Workflow v2 separates two distinct lifecycle operations:

404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414

1515
<link rel="search" type="application/opensearchdescription+xml" title="Durable Workflow" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.bdb910b5.css">
16-
<link rel="preload" href="/assets/js/runtime~main.66cf951f.js" as="script">
16+
<link rel="preload" href="/assets/js/runtime~main.d7f8a815.js" as="script">
1717
<link rel="preload" href="/assets/js/main.f3ccfcab.js" as="script">
1818
</head>
1919
<body class="navigation-with-keyboard">
2020
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"dark")}()</script><div id="__docusaurus">
2121
<div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/logo.svg" alt="Workflow Logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/logo.svg" alt="Workflow Logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Durable Workflow</b></a><a class="navbar__item navbar__link" href="/docs/installation/">Docs</a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/docs/introduction/">1.x</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/2.0/introduction/">2.0</a></li><li><a class="dropdown__link" href="/docs/introduction/">1.x</a></li></ul></div><a class="navbar__item navbar__link" href="/blog/">Blog</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/durable-workflow/workflow" target="_blank" rel="noopener noreferrer" aria-label="Star Durable Workflow on GitHub" class="navbar-github-star-link navbar__item navbar__link" label="Star on GitHub"><svg aria-hidden="true" class="navbar-github-star-link__icon" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8a8.01 8.01 0 0 0 5.47 7.59c.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.5-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.56 7.56 0 0 1 8 4.76c.68 0 1.36.09 2 .27 1.53-1.03 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.28.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"></path></svg><span class="navbar-github-star-link__count" title="GitHub stars">1.2K</span></a><a href="https://github.com/durable-workflow/workflow" target="_blank" rel="noopener noreferrer" aria-label="Star Durable Workflow on GitHub" class="navbar-github-star-link navbar__link navbar-github-star-link--mobile-topbar" label="Star on GitHub"><svg aria-hidden="true" class="navbar-github-star-link__icon" viewBox="0 0 16 16"><path d="M8 0C3.58 0 0 3.58 0 8a8.01 8.01 0 0 0 5.47 7.59c.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.5-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.56 7.56 0 0 1 8 4.76c.68 0 1.36.09 2 .27 1.53-1.03 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.28.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"></path></svg><span class="navbar-github-star-link__count" title="GitHub stars">1.2K</span></a><div class="toggle_vylO colorModeToggle_x44X"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently dark mode)" aria-label="Switch between dark and light mode (currently dark mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><main class="container margin-vert--xl"><div class="row"><div class="col col--6 col--offset-3"><h1 class="hero__title">Page Not Found</h1><p>We could not find what you were looking for.</p><p>Please contact the owner of the site that linked you to the original URL and let them know their link is broken.</p></div></div></main></div><div><footer class="footer footer--dark"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Docs</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/docs/introduction/">Introduction</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/installation/">Installation</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://discord.gg/xu5aDDpqVy" target="_blank" rel="noopener noreferrer" class="footer__link-item">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://x.com/DurableWorkflow" target="_blank" rel="noopener noreferrer" class="footer__link-item">X<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">More</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://durable-workflow.com/llms-full.txt" target="_blank" rel="noopener noreferrer" class="footer__link-item">LLM Docs<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://packagist.org/packages/durable-workflow/workflow" target="_blank" rel="noopener noreferrer" class="footer__link-item">Packagist<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2026 <a href="https://durable-workflow.com">Durable Workflow</a>.</div></div></div></footer></div></div>
22-
<script src="/assets/js/runtime~main.66cf951f.js"></script>
22+
<script src="/assets/js/runtime~main.d7f8a815.js"></script>
2323
<script src="/assets/js/main.f3ccfcab.js"></script>
2424
</body>
2525
</html>

assets/js/78a6fab6.242f1db1.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)