pub struct WorkflowRunner { /* private fields */ }Expand description
The main workflow runner that executes workflow definitions
Implementations§
Source§impl WorkflowRunner
impl WorkflowRunner
Sourcepub fn new(workflow: WorkflowDefinition) -> WorkflowResult<Self>
pub fn new(workflow: WorkflowDefinition) -> WorkflowResult<Self>
Creates a new WorkflowRunner for the given workflow definition
Sourcepub fn with_secret_manager(self, manager: Arc<dyn SecretManager>) -> Self
pub fn with_secret_manager(self, manager: Arc<dyn SecretManager>) -> Self
Sets the secret manager for $secret expression variable
Sourcepub fn with_listener(self, listener: Arc<dyn WorkflowExecutionListener>) -> Self
pub fn with_listener(self, listener: Arc<dyn WorkflowExecutionListener>) -> Self
Sets the execution listener for workflow/task events
Sourcepub fn with_event_bus(self, bus: SharedEventBus) -> Self
pub fn with_event_bus(self, bus: SharedEventBus) -> Self
Sets the event bus for emit/listen tasks
Sourcepub fn with_sub_workflow(self, workflow: WorkflowDefinition) -> Self
pub fn with_sub_workflow(self, workflow: WorkflowDefinition) -> Self
Registers a sub-workflow that can be invoked via run: workflow
Keyed by “namespace/name/version”
Sourcepub fn with_call_handler(self, handler: Box<dyn CallHandler>) -> Self
pub fn with_call_handler(self, handler: Box<dyn CallHandler>) -> Self
Registers a custom call handler for a specific call type (e.g., “grpc”, “openapi”, “asyncapi”, “a2a”)
Sourcepub fn with_run_handler(self, handler: Box<dyn RunHandler>) -> Self
pub fn with_run_handler(self, handler: Box<dyn RunHandler>) -> Self
Registers a custom run handler for a specific run type (e.g., “container”, “script”)
Sourcepub fn with_function(self, name: &str, task: TaskDefinition) -> Self
pub fn with_function(self, name: &str, task: TaskDefinition) -> Self
Registers a named function definition for call.function resolution
This allows registering external function definitions that can be
referenced by call: <functionName> in workflows, similar to
Java SDK’s cataloged function mechanism.
Sourcepub fn with_handler_registry(self, registry: HandlerRegistry) -> Self
pub fn with_handler_registry(self, registry: HandlerRegistry) -> Self
Sets the entire handler registry (used for propagating handlers to child runners)
Sourcepub fn with_custom_task_handler(
self,
handler: Box<dyn CustomTaskHandler>,
) -> Self
pub fn with_custom_task_handler( self, handler: Box<dyn CustomTaskHandler>, ) -> Self
Registers a custom task handler for a specific custom task type
Sourcepub async fn run(&self, input: Value) -> WorkflowResult<Value>
pub async fn run(&self, input: Value) -> WorkflowResult<Value>
Runs the workflow with the given input and returns the output
Sourcepub fn workflow(&self) -> &WorkflowDefinition
pub fn workflow(&self) -> &WorkflowDefinition
Returns a reference to the workflow definition
Sourcepub fn handle(&self) -> WorkflowHandle
pub fn handle(&self) -> WorkflowHandle
Returns a WorkflowHandle that can suspend/resume the running workflow
Must be called before run(). The handle shares suspend/resume state
with the workflow context via Arc.
Sourcepub fn schedule(self, input: Value) -> ScheduledWorkflow
pub fn schedule(self, input: Value) -> ScheduledWorkflow
Runs the workflow on a recurring schedule based on the workflow’s
schedule.every or schedule.cron definition.
For every: runs the workflow at fixed intervals.
For cron: currently not supported (requires cron parsing library).
Returns a ScheduledWorkflow that can be cancelled to stop the schedule.
If no schedule is defined, runs once and returns a completed handle.