@@ -87,8 +87,8 @@ That's it! You just ran your first Cano workflow.
8787
8888- ** 🏗️ Simple API** : A single ` Node ` trait handles everything - no complex type hierarchies
8989- ** 🔗 Simple Configuration** : Fluent builder pattern makes setup intuitive
90- - ** 🔄 Built-in Retries** : Configurable retry logic for resilient workflows
91- - ** 💾 Shared store ** : Thread-safe key-value store for data passing between nodes
90+ - ** 🔄 Smart Retries** : Multiple retry strategies (none, fixed, exponential backoff) with jitter support
91+ - ** 💾 Shared Store ** : Thread-safe key-value store for data passing between nodes
9292- ** 🌊 Complex Workflows** : Chain nodes together into sophisticated state machine pipelines
9393- ** ⚡ Type Safety** : Enum-driven state transitions with compile-time safety
9494- ** 🚀 High Performance** : Minimal overhead with direct execution for maximum throughput
@@ -178,16 +178,71 @@ let result = flow.orchestrate(&store).await?;
178178
179179### Built-in Retry Logic
180180
181- Every node includes configurable retry logic:
181+ Every node includes configurable retry logic with multiple strategies:
182+
183+ #### Retry Modes
184+
185+ ** No Retries** - Fail fast for critical operations:
182186
183187``` rust
184- let config = NodeConfig :: new ()
185- . with_retries (5 , Duration :: from_secs (1 )); // 5 retries, 1s wait between attempts
188+ impl Node <WorkflowState > for CriticalNode {
189+ fn config (& self ) -> NodeConfig {
190+ NodeConfig :: minimal () // No retries, fail immediately
191+ }
192+ // ... rest of implementation
193+ }
194+ ```
195+
196+ ** Fixed Retries** - Consistent delays between attempts:
186197
187- // Or use minimal retries for fast-failing nodes
188- let config = NodeConfig :: minimal (); // 1 retry, no wait
198+ ``` rust
199+ impl Node <WorkflowState > for ReliableNode {
200+ fn config (& self ) -> NodeConfig {
201+ NodeConfig :: new (). with_fixed_retry (3 , Duration :: from_secs (2 ))
202+ // 3 retries with 2 second delays
203+ }
204+ // ... rest of implementation
205+ }
189206```
190207
208+ ** Exponential Backoff** - Smart retry with increasing delays:
209+
210+ ``` rust
211+ impl Node <WorkflowState > for ResilientNode {
212+ fn config (& self ) -> NodeConfig {
213+ NodeConfig :: new (). with_exponential_retry (5 )
214+ // 5 retries with exponential backoff (100ms, 200ms, 400ms, 800ms, 1.6s)
215+ }
216+ // ... rest of implementation
217+ }
218+ ```
219+
220+ ** Custom Exponential Backoff** - Full control over retry behavior:
221+
222+ ``` rust
223+ impl Node <WorkflowState > for CustomNode {
224+ fn config (& self ) -> NodeConfig {
225+ NodeConfig :: new (). with_retry (
226+ RetryMode :: exponential_custom (
227+ 3 , // max retries
228+ Duration :: from_millis (50 ), // base delay
229+ 3.0 , // multiplier
230+ Duration :: from_secs (10 ), // max delay cap
231+ 0.2 , // 20% jitter
232+ )
233+ )
234+ }
235+ // ... rest of implementation
236+ }
237+ ```
238+
239+ #### Why Use Different Retry Modes?
240+
241+ - ** None** : Database transactions, critical validations where failure should be immediate
242+ - ** Fixed** : Network calls, file operations where consistent timing is preferred
243+ - ** Exponential** : API calls, external services where you want to back off gracefully
244+ - ** Custom Exponential** : High-load scenarios where you need precise control over timing and jitter
245+
191246### Complex Workflows
192247
193248Chain multiple nodes together to build sophisticated state machine pipelines:
0 commit comments