pub struct WorkflowExecutor { /* private fields */ }Expand description
Handles the execution of workflows and their tasks
The WorkflowExecutor is responsible for:
- Evaluating workflow conditions
- Orchestrating task execution within workflows
- Managing workflow-level error handling
- Recording audit trails
Implementations§
Source§impl WorkflowExecutor
impl WorkflowExecutor
Sourcepub fn new(task_executor: Arc<TaskExecutor>, engine: Arc<Engine>) -> Self
pub fn new(task_executor: Arc<TaskExecutor>, engine: Arc<Engine>) -> Self
Create a new WorkflowExecutor
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 async fn execute(
&self,
workflow: &Workflow,
message: &mut Message,
now: DateTime<Utc>,
) -> Result<bool>
pub async fn execute( &self, workflow: &Workflow, message: &mut Message, now: DateTime<Utc>, ) -> Result<bool>
Execute a workflow if its condition is met
This method:
- Evaluates the workflow condition
- Executes tasks sequentially if condition is met
- Handles error recovery based on workflow configuration
- Updates message metadata and audit trail
§Arguments
workflow- The workflow to executemessage- The message being processed
§Returns
Result<bool>- Ok(true) if workflow was executed, Ok(false) if skipped, Err on failure
Sourcepub async fn execute_with_trace(
&self,
workflow: &Workflow,
message: &mut Message,
trace: &mut ExecutionTrace,
now: DateTime<Utc>,
) -> Result<bool>
pub async fn execute_with_trace( &self, workflow: &Workflow, message: &mut Message, trace: &mut ExecutionTrace, now: DateTime<Utc>, ) -> Result<bool>
Execute a workflow with step-by-step tracing
Similar to execute but records execution steps for debugging.
Sourcepub async fn run_all(
&self,
workflows: &[&Workflow],
message: &mut Message,
trace: Option<&mut ExecutionTrace>,
now: DateTime<Utc>,
) -> Result<()>
pub async fn run_all( &self, workflows: &[&Workflow], message: &mut Message, trace: Option<&mut ExecutionTrace>, now: DateTime<Utc>, ) -> Result<()>
Drive a message through workflows in order, grouping maximal runs of
consecutive fully_sync workflows into a single shared-arena scope
(execute_sync_workflow_run) and falling back to the per-workflow
.await path (execute_inner) for any workflow containing an async
task. This is the single orchestration entry for all four
Engine::process_message* variants.
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowExecutor
impl !UnwindSafe for WorkflowExecutor
impl Freeze for WorkflowExecutor
impl Send for WorkflowExecutor
impl Sync for WorkflowExecutor
impl Unpin for WorkflowExecutor
impl UnsafeUnpin for WorkflowExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more