Interface NodeExecutor
- All Known Implementing Classes:
CodeExecutor, CsvExecutor, DatabaseExecutor, EmailSendExecutor, EmbeddingExecutor, ExecuteCommandExecutor, FileTriggerExecutor, FilterExecutor, HttpRequestExecutor, IfExecutor, LlmChatExecutor, LoopExecutor, ManualTriggerExecutor, MergeExecutor, ParallelExecutor, RagExecutor, RateLimitExecutor, RetryExecutor, ScheduleTriggerExecutor, SetExecutor, SlackExecutor, SortExecutor, SubworkflowExecutor, SwitchExecutor, TextClassifierExecutor, TryCatchExecutor, WebhookTriggerExecutor
public interface NodeExecutor
Core interface for defining workflow node execution logic.
Each node type in a workflow (e.g., "httpRequest", "if", "code") must have a
corresponding implementation of this interface registered in the
NodeExecutorRegistry.
The execution engine invokes execute(Node, Map, ExecutionService.ExecutionContext) when the workflow flow reaches
the node.
Contract
- Input: Receives execution context and aggregated data from previous nodes.
- Output: Returns a Map of data that becomes the input for subsequent nodes.
- State: Implementations should be stateless regarding
workflow instance data.
Use the
contextto access shared state if absolutely necessary. - Errors: Should throw
NodeExecutionExceptionfor anticipated failures to allow the engine to handle retries or error flows.
Thread Safety
Implementations must be thread-safe as a single instance is shared across all executing workflows. Avoid mutable instance fields.
-
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.
-
Method Details
-
execute
Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Executes the business logic for this node type.- 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. - Throws:
RuntimeException- If execution fails. The engine will catch this and determine whether to retry or fail the workflow based on policy.
-
getNodeType
String getNodeType()Unique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.- Returns:
- The unique type string (e.g., "httpRequest", "llmChat").
-