pub struct TaskExecutor { /* private fields */ }Expand description
Handles the execution of tasks with their associated functions.
The TaskExecutor is responsible for:
- Routing async functions (http_call, enrich, publish_kafka, custom) to
the matching registered handler via [
crate::engine::functions::DynAsyncFunctionHandler] - Owning the function registry
Sync built-ins are not routed through execute — workflow_executor
calls FunctionConfig::try_execute_in_arena inside its sync stretch
for those, sharing one arena across consecutive sync tasks.
Implementations§
Source§impl TaskExecutor
impl TaskExecutor
Sourcepub fn new(
task_functions: Arc<HashMap<String, BoxedFunctionHandler>>,
engine: Arc<Engine>,
) -> Self
pub fn new( task_functions: Arc<HashMap<String, BoxedFunctionHandler>>, engine: Arc<Engine>, ) -> Self
Create a new TaskExecutor
Sourcepub async fn execute(
&self,
task: &Task,
message: &mut Message,
) -> Result<(TaskOutcome, Vec<Change>)>
pub async fn execute( &self, task: &Task, message: &mut Message, ) -> Result<(TaskOutcome, Vec<Change>)>
Execute a single task. Sync built-ins reach here only when called from
outside the workflow executor’s sync-stretch path — they fall back to
their execute() methods (which open a fresh thread-local arena).
Sourcepub fn has_function(&self, name: &str) -> bool
pub fn has_function(&self, name: &str) -> bool
Whether this executor can actually run a task named name.
true for a BuiltinKind::SelfContained built-in, which this crate
executes itself, and for any name with a registered handler.
false for http_call / enrich / publish_kafka with no handler
registered — those deserialize into a typed built-in variant and so pass
Engine::new, but fail at dispatch with
DataflowError::FunctionNotFound on the first message. This is
deliberately narrower than “is this a known name”; use
crate::is_builtin_function for that.
Sourcepub fn task_functions(&self) -> Arc<HashMap<String, BoxedFunctionHandler>>
pub fn task_functions(&self) -> Arc<HashMap<String, BoxedFunctionHandler>>
Get a clone of the task_functions Arc for reuse in new engines
Sourcepub fn custom_function_count(&self) -> usize
pub fn custom_function_count(&self) -> usize
Get the count of registered custom functions