pub struct StepBuilder<D: WorkflowData> { /* private fields */ }Expand description
Builder for configuring a single step in the workflow.
Owns the WorkflowBuilder, consuming self on each method call. This avoids all lifetime/borrow issues.
Implementations§
Source§impl<D: WorkflowData> StepBuilder<D>
impl<D: WorkflowData> StepBuilder<D>
Sourcepub fn on_error(self, behavior: ErrorBehavior) -> Self
pub fn on_error(self, behavior: ErrorBehavior) -> Self
Set the error handling behavior for this step.
Sourcepub fn config(self, config: Value) -> Self
pub fn config(self, config: Value) -> Self
Attach arbitrary JSON configuration to this step.
The step can read it at runtime via context.step.step_config.
Sourcepub fn compensate_with<C: StepBody + Default + 'static>(self) -> Self
pub fn compensate_with<C: StepBody + Default + 'static>(self) -> Self
Add a compensation step for saga rollback.
Sourcepub fn then<S: StepBody + Default + 'static>(self) -> StepBuilder<D>
pub fn then<S: StepBody + Default + 'static>(self) -> StepBuilder<D>
Chain the next step. Wires an outcome from the current step to the new one.
Sourcepub fn then_fn(
self,
f: impl Fn() -> ExecutionResult + Send + Sync + 'static,
) -> StepBuilder<D>
pub fn then_fn( self, f: impl Fn() -> ExecutionResult + Send + Sync + 'static, ) -> StepBuilder<D>
Chain an inline function step.
Sourcepub fn wait_for(self, event_name: &str, event_key: &str) -> StepBuilder<D>
pub fn wait_for(self, event_name: &str, event_key: &str) -> StepBuilder<D>
Insert a WaitFor step.
Sourcepub fn delay(self, duration: Duration) -> StepBuilder<D>
pub fn delay(self, duration: Duration) -> StepBuilder<D>
Insert a Delay step.
Sourcepub fn if_do<S: StepBody + Default + 'static>(
self,
build_children: impl FnOnce(&mut WorkflowBuilder<D>),
) -> StepBuilder<D>
pub fn if_do<S: StepBody + Default + 'static>( self, build_children: impl FnOnce(&mut WorkflowBuilder<D>), ) -> StepBuilder<D>
Insert an If container step with child steps built by the closure. The type parameter S is the step type used for the If condition evaluation.
Sourcepub fn while_do<S: StepBody + Default + 'static>(
self,
build_children: impl FnOnce(&mut WorkflowBuilder<D>),
) -> StepBuilder<D>
pub fn while_do<S: StepBody + Default + 'static>( self, build_children: impl FnOnce(&mut WorkflowBuilder<D>), ) -> StepBuilder<D>
Insert a While container step.
Sourcepub fn for_each<S: StepBody + Default + 'static>(
self,
build_children: impl FnOnce(&mut WorkflowBuilder<D>),
) -> StepBuilder<D>
pub fn for_each<S: StepBody + Default + 'static>( self, build_children: impl FnOnce(&mut WorkflowBuilder<D>), ) -> StepBuilder<D>
Insert a ForEach container step.
Sourcepub fn saga(
self,
build_children: impl FnOnce(&mut WorkflowBuilder<D>),
) -> StepBuilder<D>
pub fn saga( self, build_children: impl FnOnce(&mut WorkflowBuilder<D>), ) -> StepBuilder<D>
Insert a Saga container step with child steps.
Sourcepub fn parallel(
self,
build_branches: impl FnOnce(ParallelBuilder<D>) -> ParallelBuilder<D>,
) -> StepBuilder<D>
pub fn parallel( self, build_branches: impl FnOnce(ParallelBuilder<D>) -> ParallelBuilder<D>, ) -> StepBuilder<D>
Start a parallel block.
Sourcepub fn end_workflow(self) -> WorkflowBuilder<D>
pub fn end_workflow(self) -> WorkflowBuilder<D>
Mark this step as the terminal step (no further outcomes).