Skip to main content

WorkflowDefinition

Trait WorkflowDefinition 

Source
pub trait WorkflowDefinition: Send + Sync {
    type Input: Serialize + DeserializeOwned + Send + Sync;
    type Output: Serialize + DeserializeOwned + Send + Sync;

    // Required methods
    fn workflow_type() -> &'static str;
    fn run(
        &self,
        ctx: WorkflowContext,
        input: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, CoreError>> + Send + '_>>;
}
Expand description

A trait for defining workflow types

Workflows are the main unit of execution in Sidebyside. They define the orchestration logic that coordinates activities and decision points.

Required Associated Types§

Source

type Input: Serialize + DeserializeOwned + Send + Sync

The input type for this workflow

Source

type Output: Serialize + DeserializeOwned + Send + Sync

The output type for this workflow

Required Methods§

Source

fn workflow_type() -> &'static str

Get the workflow type name

Source

fn run( &self, ctx: WorkflowContext, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, CoreError>> + Send + '_>>

Run the workflow with the given context and input

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§