Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/polyglot/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@ or a worker minor newer than the server's advertised minor is rejected. The
SDK and Server release versions are tracked independently. Their runtime
protocol manifests determine compatibility.

## Worker task concurrency {#worker-task-concurrency}

The bounded worker lanes below require Rust SDK **4.3.1 or newer**. Check the crate in `Cargo.lock` before using them: the installation pin above belongs to a separate qualified artifact tuple and may select an older SDK. The [published-package acceptance](https://github.com/durable-workflow/sdk-rust/issues/107#issuecomment-6360719863) verifies three configured slots, a fourth callback admitted after a slot is released, and seven completed workflows including a handled activity failure. This guide does not change the Server protocol requirements above.

`Worker::max_concurrent_workflow_tasks(...)` and `Worker::max_concurrent_activity_tasks(...)` each default to **10**. `run()` and `run_until()` use independent bounded workflow and remote-activity lanes. Set a limit to **1** for serial execution within that task family. For example, configure an existing client before registering your application handlers:

```rust
use durable_workflow::Worker;

let mut worker = Worker::new(client.clone(), "payments")
.max_concurrent_workflow_tasks(1)
.max_concurrent_activity_tasks(1);
```

Register the workflow and activity handlers, then start `run()` or `run_until()` as usual. Setting both limits to one still permits a workflow task and a remote activity task to run at the same time. Queries keep a separate polling lane. Worker clones share the configured capacity, including simultaneous `run_once()` calls; cloning does not create another independent allowance.

Heartbeat availability follows actual claimed tasks, including input/history loading, callback execution and settlement. An empty long poll leaves capacity available. Success, failure, refusal and cancellation release the local slot. Inline local activities occupy their **workflow-task** slot and bypass the remote-activity pool, so the activity limit does not separately cap inline local execution across workflows.

Handlers are async futures on Tokio and must yield for other work to progress. Use `tokio::task::spawn_blocking` or a separate process for blocking work, with an explicit cancellation and shutdown boundary. Raising concurrency does not provide CPU isolation or make a detached thread cancellable. See the [Worker API](https://rust.durable-workflow.com/durable_workflow/struct.Worker.html) for the installed SDK's controls.

## Local activities

Rust SDK 3.1.0 adds inline local execution on workers configured with
Expand Down
20 changes: 20 additions & 0 deletions i18n/de/docusaurus-plugin-content-docs/current/polyglot/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@ eine andere Hauptversion oder eine höhere Worker-Nebenversion als die vom
Server gemeldete werden abgelehnt. SDK- und Server-Release-Versionen werden
unabhängig geführt. Ihre Laufzeit-Protokollmanifeste bestimmen die Kompatibilität.

## Parallelität der Worker-Tasks {#worker-task-concurrency}

Die folgenden begrenzten Ausführungsspuren benötigen Rust SDK **4.3.1 oder neuer**. Prüfen Sie die Version in `Cargo.lock`: Die oben fixierte Installation gehört zu einem anderen qualifizierten Artefaktsatz und kann ein älteres SDK auswählen. Die [Akzeptanz des veröffentlichten Pakets](https://github.com/durable-workflow/sdk-rust/issues/107#issuecomment-6360719863) prüft drei konfigurierte Slots, einen vierten Callback erst nach Slot-Freigabe und sieben abgeschlossene Workflows einschließlich eines behandelten Aktivitätsfehlers. Die oben beschriebenen Server-Protokollanforderungen gelten weiterhin.

`Worker::max_concurrent_workflow_tasks(...)` und `Worker::max_concurrent_activity_tasks(...)` haben jeweils den Standardwert **10**. `run()` und `run_until()` nutzen unabhängige begrenzte Spuren für Workflow und entfernte Aktivität. Wählen Sie **1** für sequenzielle Ausführung innerhalb einer Task-Familie. Konfigurieren Sie zum Beispiel einen vorhandenen Client vor der Handler-Registrierung:

```rust
use durable_workflow::Worker;

let mut worker = Worker::new(client.clone(), "payments")
.max_concurrent_workflow_tasks(1)
.max_concurrent_activity_tasks(1);
```

Registrieren Sie die Handler und starten Sie dann `run()` oder `run_until()` wie gewohnt. Zwei Grenzen von eins erlauben weiterhin einen Workflow-Task und einen entfernten Aktivitätstask gleichzeitig. Abfragen behalten ihre eigene Polling-Spur. Worker-Klone teilen die konfigurierte Kapazität, auch bei gleichzeitigen `run_once()`-Aufrufen. Klonen schafft kein weiteres unabhängiges Kontingent.

Die Heartbeat-Verfügbarkeit folgt tatsächlich beanspruchten Tasks einschließlich Eingabe-/History-Laden, Callback-Ausführung und Abschlussbestätigung. Ein leerer Long-Poll lässt Kapazität verfügbar. Erfolg, Fehler, Ablehnung und Abbruch geben den lokalen Slot frei. Inline ausgeführte lokale Aktivitäten belegen ihren **Workflow-Task**-Slot und umgehen den entfernten Aktivitätspool. Das Aktivitätslimit begrenzt deshalb Inline-Ausführung über mehrere Workflows nicht separat.

Handler sind async Futures auf Tokio und müssen Ausführungszeit abgeben. Verwenden Sie für blockierende Arbeit `tokio::task::spawn_blocking` oder einen separaten Prozess mit ausdrücklicher Abbruch- und Shutdown-Grenze. Mehr Parallelität isoliert keine CPU und macht einen abgetrennten Thread nicht abbrechbar. Siehe die [Worker-API](https://rust.durable-workflow.com/durable_workflow/struct.Worker.html) des installierten SDKs.

## Lokale Aktivitäten {#local-activities}

Rust SDK 3.1.0 ergänzt lokale Inline-Ausführung auf Workern mit
Expand Down
2 changes: 1 addition & 1 deletion i18n/de/source-hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"polyglot/prerelease-history-migration.md": "a57f05f492228a8a67791f9152648a1e5f80856325b78777cf63b6ef49b7413c",
"polyglot/python.md": "174acc170fc749284b5115f995996885c04056340d44bd334c6cee33e288abd1",
"polyglot/rust-cloud-quickstart.md": "2303434fc9302a81a8381ad4836423ef9952eb3201a4574c432254e3cb68c5f3",
"polyglot/rust.md": "32de05a771b5ee6d8cf54fdd408222372995ce29c8be63102abe58b977ac8ef0",
"polyglot/rust.md": "0bb9929cafe2751e1fde615ee033e127c5f6c6eaa8d4bbae941b4e1e86b06d58",
"polyglot/server-api-reference.md": "e94af77a13b341d6fdc9941d4ee94e5053ab932d2e77069b238eb33351414e83",
"polyglot/server-config-reference.md": "edb4cf00b9df2c9946b32a81c6bb2c4db6eaee89794b85286c61c235a4846414",
"polyglot/server-role-topology.md": "3d048f0c6b5f179399622508f51e67fff8aa5a6d5b2492533fc720eeec2c27f2",
Expand Down
20 changes: 20 additions & 0 deletions i18n/es/docusaurus-plugin-content-docs/current/polyglot/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ Server negocia las cabeceras del protocolo de workers dentro de la versión prin

La negociación rechaza las incompatibilidades. Se rechaza una cabecera ausente o malformada, otra versión principal o una versión menor del worker superior a la anunciada por el servidor. Las versiones del SDK y de Server se gestionan por separado. Sus manifiestos de protocolo en runtime determinan la compatibilidad.

## Concurrencia de tareas del worker {#worker-task-concurrency}

Los carriles acotados descritos aquí requieren Rust SDK **4.3.1 o posterior**. Compruebe la versión de `Cargo.lock`: la instalación fijada arriba pertenece a otra tupla cualificada y puede seleccionar un SDK anterior. La [verificación del paquete publicado](https://github.com/durable-workflow/sdk-rust/issues/107#issuecomment-6360719863) confirma tres slots configurados, una cuarta llamada admitida al liberarse uno, y siete workflows completados, incluido un fallo de actividad manejado. Siguen vigentes los requisitos de protocolo del Server descritos arriba.

`Worker::max_concurrent_workflow_tasks(...)` y `Worker::max_concurrent_activity_tasks(...)` tienen un valor predeterminado de **10** cada uno. `run()` y `run_until()` usan carriles independientes y acotados para workflow y actividad remota. Configure **1** para ejecución secuencial dentro de esa familia de tareas. Por ejemplo, configure un cliente existente antes de registrar sus handlers:

```rust
use durable_workflow::Worker;

let mut worker = Worker::new(client.clone(), "payments")
.max_concurrent_workflow_tasks(1)
.max_concurrent_activity_tasks(1);
```

Registre los handlers y después inicie `run()` o `run_until()` normalmente. Dos límites de uno aún permiten ejecutar simultáneamente una tarea de workflow y una actividad remota. Las consultas mantienen su carril de polling separado. Los clones comparten la capacidad configurada, incluso entre llamadas simultáneas a `run_once()`; clonar no crea otro cupo independiente.

La disponibilidad anunciada en heartbeats sigue las tareas realmente reclamadas, incluida la carga de entrada/historial, la ejecución y la confirmación. Un long poll vacío deja capacidad disponible. Éxito, fallo, negativa y cancelación liberan el slot local. Las actividades locales inline ocupan su slot de **tarea de workflow** y evitan el pool remoto; el límite de actividades no acota por separado la ejecución inline entre workflows.

Los handlers son futures async de Tokio y deben ceder el control. Use `tokio::task::spawn_blocking` o un proceso separado para trabajo bloqueante, con límites explícitos de cancelación y apagado. Aumentar concurrencia no aísla CPU ni hace cancelable un thread desacoplado. Consulte la [API de Worker](https://rust.durable-workflow.com/durable_workflow/struct.Worker.html) del SDK instalado.

## Actividades locales {#local-activities}

El SDK de Rust 3.1.0 añade ejecución local en el propio worker con `Worker::local_activities(true)`. Registra callbacks con los métodos ordinarios de registro de actividades y utiliza los métodos de actividad local del contexto de workflow. Consulta el [ejemplo ejecutable](https://github.com/durable-workflow/sdk-rust/blob/3.1.0/examples/local_activities.rs) y la [referencia de LocalActivityOptions](https://rust.durable-workflow.com/durable_workflow/struct.LocalActivityOptions.html) para configurar reintentos y tiempos de espera.
Expand Down
2 changes: 1 addition & 1 deletion i18n/es/source-hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"polyglot/prerelease-history-migration.md": "a57f05f492228a8a67791f9152648a1e5f80856325b78777cf63b6ef49b7413c",
"polyglot/python.md": "174acc170fc749284b5115f995996885c04056340d44bd334c6cee33e288abd1",
"polyglot/rust-cloud-quickstart.md": "2303434fc9302a81a8381ad4836423ef9952eb3201a4574c432254e3cb68c5f3",
"polyglot/rust.md": "32de05a771b5ee6d8cf54fdd408222372995ce29c8be63102abe58b977ac8ef0",
"polyglot/rust.md": "0bb9929cafe2751e1fde615ee033e127c5f6c6eaa8d4bbae941b4e1e86b06d58",
"polyglot/server-api-reference.md": "e94af77a13b341d6fdc9941d4ee94e5053ab932d2e77069b238eb33351414e83",
"polyglot/server-config-reference.md": "edb4cf00b9df2c9946b32a81c6bb2c4db6eaee89794b85286c61c235a4846414",
"polyglot/server-role-topology.md": "3d048f0c6b5f179399622508f51e67fff8aa5a6d5b2492533fc720eeec2c27f2",
Expand Down
20 changes: 20 additions & 0 deletions i18n/fr/docusaurus-plugin-content-docs/current/polyglot/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ celle annoncée par Server est refusée. Les versions de publication SDK et
Server sont suivies indépendamment. Leurs manifestes de protocole runtime
déterminent la compatibilité.

## Concurrence des tâches du worker {#worker-task-concurrency}

Les voies bornées ci-dessous nécessitent Rust SDK **4.3.1 ou ultérieur**. Vérifiez la version dans `Cargo.lock` : l’installation fixée plus haut appartient à une autre combinaison qualifiée et peut sélectionner un ancien SDK. La [vérification du paquet publié](https://github.com/durable-workflow/sdk-rust/issues/107#issuecomment-6360719863) confirme trois emplacements configurés, un quatrième callback admis après libération d’un emplacement et sept workflows terminés, dont un échec d’activité traité. Les exigences de protocole Server précédentes restent applicables.

`Worker::max_concurrent_workflow_tasks(...)` et `Worker::max_concurrent_activity_tasks(...)` valent chacun **10** par défaut. `run()` et `run_until()` utilisent des voies bornées indépendantes pour workflow et activité distante. Choisissez **1** pour une exécution séquentielle au sein de cette famille de tâches. Par exemple, configurez un client existant avant d’enregistrer les handlers applicatifs :

```rust
use durable_workflow::Worker;

let mut worker = Worker::new(client.clone(), "payments")
.max_concurrent_workflow_tasks(1)
.max_concurrent_activity_tasks(1);
```

Enregistrez les handlers, puis lancez `run()` ou `run_until()` normalement. Deux limites à un permettent encore une tâche de workflow et une tâche d’activité distante simultanées. Les requêtes de lecture gardent leur propre voie de polling. Les clones partagent la capacité configurée, y compris entre appels simultanés à `run_once()` ; cloner ne crée pas de quota indépendant supplémentaire.

La disponibilité des heartbeats suit les tâches réellement réclamées : chargement d’entrée/historique, exécution et confirmation. Un long poll vide laisse la capacité disponible. Succès, échec, refus et annulation libèrent l’emplacement local. Les activités locales inline occupent leur emplacement de **tâche de workflow** et contournent le pool distant ; la limite d’activité ne borne donc pas séparément l’exécution inline entre workflows.

Les handlers sont des futures async Tokio et doivent céder la main. Utilisez `tokio::task::spawn_blocking` ou un processus séparé pour le travail bloquant, avec une limite explicite d’annulation et d’arrêt. Augmenter la concurrence n’isole pas le CPU et ne rend pas un thread détaché annulable. Voir l’[API Worker](https://rust.durable-workflow.com/durable_workflow/struct.Worker.html) du SDK installé.

## Activités locales {#local-activities}

Le SDK Rust 3.1.0 ajoute l’exécution locale en ligne sur les workers configurés
Expand Down
2 changes: 1 addition & 1 deletion i18n/fr/source-hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"polyglot/prerelease-history-migration.md": "a57f05f492228a8a67791f9152648a1e5f80856325b78777cf63b6ef49b7413c",
"polyglot/python.md": "174acc170fc749284b5115f995996885c04056340d44bd334c6cee33e288abd1",
"polyglot/rust-cloud-quickstart.md": "2303434fc9302a81a8381ad4836423ef9952eb3201a4574c432254e3cb68c5f3",
"polyglot/rust.md": "32de05a771b5ee6d8cf54fdd408222372995ce29c8be63102abe58b977ac8ef0",
"polyglot/rust.md": "0bb9929cafe2751e1fde615ee033e127c5f6c6eaa8d4bbae941b4e1e86b06d58",
"polyglot/server-api-reference.md": "e94af77a13b341d6fdc9941d4ee94e5053ab932d2e77069b238eb33351414e83",
"polyglot/server-config-reference.md": "edb4cf00b9df2c9946b32a81c6bb2c4db6eaee89794b85286c61c235a4846414",
"polyglot/server-role-topology.md": "3d048f0c6b5f179399622508f51e67fff8aa5a6d5b2492533fc720eeec2c27f2",
Expand Down
20 changes: 20 additions & 0 deletions i18n/ja/docusaurus-plugin-content-docs/current/polyglot/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ Server はメジャー `1` 内で Worker プロトコルヘッダーをネゴシ

ネゴシエーションは安全側に失敗します。ヘッダーの欠落・不正、異なるメジャー、Server が広告するマイナーより新しい Worker マイナーは拒否します。SDK と Server のリリースバージョンは独立に管理します。互換性はランタイムのプロトコルマニフェストで決まります。

## Worker タスクの並行実行 {#worker-task-concurrency}

以下の有界実行レーンには Rust SDK **4.3.1 以降**が必要です。`Cargo.lock` のバージョンを確認してください。上の固定インストールは別の検証済み構成に属し、古い SDK を選ぶ場合があります。[公開パッケージの受け入れ検証](https://github.com/durable-workflow/sdk-rust/issues/107#issuecomment-6360719863)では、設定した三つのスロット、解放後に初めて入る四つ目のコールバック、処理済みのアクティビティ失敗を含む七つのワークフロー完了を確認しています。前述の Server プロトコル要件は引き続き適用されます。

`Worker::max_concurrent_workflow_tasks(...)` と `Worker::max_concurrent_activity_tasks(...)` は、それぞれ既定値が **10** です。`run()` と `run_until()` はワークフローとリモートアクティビティで独立した有界レーンを使います。各タスク種別を逐次実行するには **1** を指定します。例えば、アプリケーションのハンドラー登録前に既存のクライアントを設定します。

```rust
use durable_workflow::Worker;

let mut worker = Worker::new(client.clone(), "payments")
.max_concurrent_workflow_tasks(1)
.max_concurrent_activity_tasks(1);
```

ハンドラーを登録し、通常どおり `run()` または `run_until()` を起動してください。両方を一にしても、ワークフロータスク一つとリモートアクティビティタスク一つは同時に実行できます。クエリは別のポーリングレーンを使います。Worker のクローンは同時の `run_once()` 呼び出しを含めて容量を共有します。クローンを作っても独立した追加枠にはなりません。

ハートビートの空き容量は、入力・履歴の読み込み、コールバック実行、結果確定を含む実際の取得済みタスクに従います。空のロングポーリングは空き容量を残します。成功、失敗、拒否、キャンセルでローカルスロットを解放します。インラインのローカルアクティビティは**ワークフロータスク**のスロットを使い、リモートアクティビティプールを通りません。アクティビティ上限は複数ワークフローのインライン実行を別枠で制限しません。

ハンドラーは Tokio の async future であり、他の処理が進むよう実行権を譲る必要があります。ブロックする処理には `tokio::task::spawn_blocking` または別プロセスを使い、キャンセルと終了の境界を明示してください。並行数を増やしても CPU は分離されず、切り離されたスレッドがキャンセル可能になるわけでもありません。インストールした SDK の [Worker API](https://rust.durable-workflow.com/durable_workflow/struct.Worker.html) を参照してください。

## ローカルアクティビティ {#local-activities}

Rust SDK 3.1.0 は `Worker::local_activities(true)` で設定した Worker にインラインのローカル実行を追加します。通常のアクティビティ登録メソッドでコールバックを登録し、ワークフローコンテキストのローカルアクティビティメソッドを使います。再試行とタイムアウトの設定は[実行可能な例](https://github.com/durable-workflow/sdk-rust/blob/3.1.0/examples/local_activities.rs)と [LocalActivityOptions リファレンス](https://rust.durable-workflow.com/durable_workflow/struct.LocalActivityOptions.html)を参照してください。
Expand Down
2 changes: 1 addition & 1 deletion i18n/ja/source-hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"polyglot/prerelease-history-migration.md": "a57f05f492228a8a67791f9152648a1e5f80856325b78777cf63b6ef49b7413c",
"polyglot/python.md": "174acc170fc749284b5115f995996885c04056340d44bd334c6cee33e288abd1",
"polyglot/rust-cloud-quickstart.md": "2303434fc9302a81a8381ad4836423ef9952eb3201a4574c432254e3cb68c5f3",
"polyglot/rust.md": "32de05a771b5ee6d8cf54fdd408222372995ce29c8be63102abe58b977ac8ef0",
"polyglot/rust.md": "0bb9929cafe2751e1fde615ee033e127c5f6c6eaa8d4bbae941b4e1e86b06d58",
"polyglot/server-api-reference.md": "e94af77a13b341d6fdc9941d4ee94e5053ab932d2e77069b238eb33351414e83",
"polyglot/server-config-reference.md": "edb4cf00b9df2c9946b32a81c6bb2c4db6eaee89794b85286c61c235a4846414",
"polyglot/server-role-topology.md": "3d048f0c6b5f179399622508f51e67fff8aa5a6d5b2492533fc720eeec2c27f2",
Expand Down
Loading
Loading