Step methods
查看 MarkdownFor the Step concept, read Step.
Commits
Dex commits each WaitFor call and each Execute call separately. Dex Server holds the Attribute writes and Channel publications of the method. It commits them together with the returned Wait or StepDecision, and only after the method returns successfully. If the method fails, Dex commits none of them. Calls to external APIs are not part of this commit.
Before it returns, a method can send heartbeat checkpoints and any number of best-effort Stream messages. They are not part of the method's commit. A Stream Store failure does not fail the Step.
Step execution local
set_step_execution_local stores a value on the current Step execution. Execute reads it with step_execution_local. Use it to pass a value from WaitFor to Execute when a Flow-level Attribute is more than you need. Both methods already receive the Step input, so do not copy the input into a local.
fn wait_for(&self, context: &mut Context, input: Self::Input) -> HandlerResult<Wait> {
context.set_step_execution_local("note", format!("approval:{input}"))?;
Ok(Wait::until(APPROVAL.for_one()))
}
fn execute(&self, context: &mut Context, _input: Self::Input) -> HandlerResult<StepDecision> {
let note: String = context.step_execution_local("note")?;
Ok(StepDecision::graceful_complete(note))
}
Example: examples/rust/src/primitives/step_execution_local/flow.rs