Class RetryExecutor
java.lang.Object
ai.nervemind.app.executor.RetryExecutor
- All Implemented Interfaces:
NodeExecutor
Executor for the "retry" node type - implements retry logic with configurable
backoff strategies.
Provides automatic retry functionality for transient failures with sophisticated backoff algorithms. Ideal for unreliable external services, rate-limited APIs, or operations that may temporarily fail.
Node Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| operations | List | [] | Operations to execute with retry protection |
| maxRetries | Integer | 3 | Maximum retry attempts |
| backoffStrategy | String | "exponential" | Backoff algorithm (see strategies below) |
| initialDelayMs | Long | 1000 | Initial delay between retries |
| maxDelayMs | Long | 30000 | Maximum delay cap |
| multiplier | Double | 2.0 | Backoff multiplier |
| jitter | Boolean | true | Add random jitter to delays |
| jitterFactor | Double | 0.1 | Maximum jitter as fraction of delay |
| retryableErrors | List | [] | Error types to retry (empty = all) |
| nonRetryableErrors | List | [] | Error types to never retry |
Backoff Strategies
- fixed - Constant delay:
initialDelayMs - linear - Linear increase:
initialDelayMs * attempt - exponential - Exponential increase:
initialDelayMs * multiplier^(attempt-1) - fibonacci - Fibonacci sequence:
initialDelayMs * fib(attempt)
Output Data
| Key | Type | Description |
|---|---|---|
| success | Boolean | True if operation eventually succeeded |
| attemptCount | Integer | Total attempts made (including initial) |
| totalDelayMs | Long | Total time spent waiting between retries |
| errors | List | Error messages from failed attempts |
| result | Map | Final operation result if successful |
Jitter
When jitter=true, a random amount (0 to jitterFactor * delay)
is added or subtracted from each delay to prevent thundering herd problems
when
multiple retry operations execute simultaneously.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRetryExecutor(NodeExecutorRegistry nodeExecutorRegistry) Creates a new RetryExecutor with the given node executor registry. -
Method Summary
Modifier and TypeMethodDescriptionexecute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Executes the business logic for this node type.Unique identifier for the node type this executor handles.
-
Constructor Details
-
RetryExecutor
Creates a new RetryExecutor with the given node executor registry.- Parameters:
nodeExecutorRegistry- the registry for accessing other node executors
-
-
Method Details
-
getNodeType
Description copied from interface:NodeExecutorUnique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.- Specified by:
getNodeTypein interfaceNodeExecutor- Returns:
- The unique type string (e.g., "httpRequest", "llmChat").
-
execute
public Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Description copied from interface:NodeExecutorExecutes the business logic for this node type.- Specified by:
executein interfaceNodeExecutor- Parameters:
node- The node definition containing parameters and configuration. UseNode.parameters()to access user settings.input- Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.context- Verification context providing access to workflow-scoped services, logger, and execution metadata.- Returns:
- A Map containing the results of this node's execution.
Keys in this map become available variables for downstream nodes.
Note: Returningnullis treated as an empty map.
-