pub struct StepOptions<Input> { /* private fields */ }Expand description
Configures one Step’s handler execution and persistence behavior.
New options preserve server timeout, retry, and durability defaults. wait_for failures fail the
Flow by default. Attribute locks apply only to the matching handler call. The type system checks
that an execute-failure recovery Step accepts the same input type.
Input is the Step input type and must implement Value. Builders consume the options
and return the updated value. Durations must fit signed 32-bit whole seconds; invalid values
fail when the Worker maps the Step definition or movement options.
Each method call retains its first loaded state snapshot and Attribute locks across retries and backoff. Later Attribute and Channel changes do not refresh that snapshot. Use a Channel wait in another Step to wait for state changes. Locks are released when the method call ends. A queued first attempt holds no locks before hand-out; a returned or retrying attempt keeps acquired locks while queued. Keep lock scope short to avoid blocking conflicting RPCs.
§Examples
use dex_sdk::{Attribute, RetryPolicy, StepOptions, WaitForFailurePolicy};
use std::time::Duration;
let balance = Attribute::<i64>::new("balance");
let options = StepOptions::<String>::new()
.execute_method_timeout(Duration::from_secs(30))
.execute_retry(RetryPolicy::new().maximum_attempts(3))
.wait_for_failure(WaitForFailurePolicy::Proceed)
.execute_lock(balance.lock());Implementations§
Source§impl<Input: Value> StepOptions<Input>
impl<Input: Value> StepOptions<Input>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates options that preserve server defaults and fail on exhausted wait_for retries.
Sourcepub fn wait_for_method_timeout(self, value: Duration) -> Self
pub fn wait_for_method_timeout(self, value: Duration) -> Self
Sets the maximum duration of one wait_for handler attempt.
Unset or zero uses two hours. With 1.35.0 (Server protocol 4): the timeout starts at
Worker hand-out,
excluding queue and lock waits, and is not shortened by retry total duration.
Each retry has a new timeout. Cancellation is cooperative; observe Context::is_cancelled
and bound external calls with their own timeouts.
Sourcepub fn execute_method_timeout(self, value: Duration) -> Self
pub fn execute_method_timeout(self, value: Duration) -> Self
Sets the maximum duration of one execute handler attempt.
Unset or zero uses two hours. With 1.35.0 (Server protocol 4): the timeout starts at
Worker hand-out,
excluding queue and lock waits, and is not shortened by retry total duration.
Each retry has a new timeout. Cancellation is cooperative; observe Context::is_cancelled
and bound external calls with their own timeouts.
Sourcepub fn heartbeat_timeout(self, value: Duration) -> Self
pub fn heartbeat_timeout(self, value: Duration) -> Self
Sets the heartbeat timeout for wait_for and execute attempts.
Zero selects the server default of one minute. Positive values must be whole seconds and at least the server-configured minimum, which defaults to ten seconds. This option applies with both synchronous and asynchronous durability. Explicit heartbeats and Stream messages refresh liveness; only heartbeat values carry retry checkpoints. A valueless heartbeat clears the checkpoint; a Stream message preserves it. Raise this limit when healthy work can remain silent for more than a minute. A method timeout still bounds the whole attempt, even when it keeps heartbeating.
Sourcepub fn wait_for_retry(self, value: RetryPolicy) -> Self
pub fn wait_for_retry(self, value: RetryPolicy) -> Self
Sets the retry policy for failed wait_for attempts.
See RetryPolicy for defaults and the shared elapsed budget. Exhaustion fails the Flow
unless Self::wait_for_failure selects WaitForFailurePolicy::Proceed.
Sourcepub fn execute_retry(self, value: RetryPolicy) -> Self
pub fn execute_retry(self, value: RetryPolicy) -> Self
Sets the retry policy for failed execute attempts.
See RetryPolicy for defaults and the shared elapsed budget. Exhaustion fails the Flow
unless Self::on_execute_failure_proceed_to selects a recovery Step.
Sourcepub fn wait_for_failure(self, value: WaitForFailurePolicy) -> Self
pub fn wait_for_failure(self, value: WaitForFailurePolicy) -> Self
Selects whether exhausted wait_for retries fail or advance the Flow.
Sourcepub fn on_execute_failure_proceed_to<RecoveryStep>(
self,
step: &RecoveryStep,
) -> Selfwhere
RecoveryStep: Step<Input = Input>,
pub fn on_execute_failure_proceed_to<RecoveryStep>(
self,
step: &RecoveryStep,
) -> Selfwhere
RecoveryStep: Step<Input = Input>,
Routes exhausted execute failures to a recovery Step with the same input type.
Sourcepub fn wait_for_durability(self, value: StepDurability) -> Self
pub fn wait_for_durability(self, value: StepDurability) -> Self
Overrides persistence durability for writes staged by wait_for.
Sourcepub fn execute_durability(self, value: StepDurability) -> Self
pub fn execute_durability(self, value: StepDurability) -> Self
Overrides persistence durability for writes staged by execute.
Sourcepub fn wait_for_lock(self, value: AttributeLock) -> Self
pub fn wait_for_lock(self, value: AttributeLock) -> Self
Adds an Attribute lock held for the wait_for invocation.
Sourcepub fn execute_lock(self, value: AttributeLock) -> Self
pub fn execute_lock(self, value: AttributeLock) -> Self
Adds an Attribute lock held for the execute invocation.
Sourcepub fn wait_for_load_attribute_map<T>(
self,
attribute_map: &AttributeMap<T>,
) -> Self
pub fn wait_for_load_attribute_map<T>( self, attribute_map: &AttributeMap<T>, ) -> Self
Loads every current instance of attribute_map for wait_for.
Sourcepub fn wait_for_load_attribute_map_instance(
self,
load: AttributeMapLoad,
) -> Self
pub fn wait_for_load_attribute_map_instance( self, load: AttributeMapLoad, ) -> Self
Loads one AttributeMap instance for wait_for.
Sourcepub fn wait_for_load_channel<T>(self, channel: &Channel<T>) -> Self
pub fn wait_for_load_channel<T>(self, channel: &Channel<T>) -> Self
Loads one Channel’s pending messages for wait_for.
Sourcepub fn wait_for_load_channel_map<T>(self, channel_map: &ChannelMap<T>) -> Self
pub fn wait_for_load_channel_map<T>(self, channel_map: &ChannelMap<T>) -> Self
Loads every current ChannelMap instance’s pending messages for wait_for.
Sourcepub fn wait_for_load_channel_map_instance(self, load: ChannelMapLoad) -> Self
pub fn wait_for_load_channel_map_instance(self, load: ChannelMapLoad) -> Self
Loads one ChannelMap instance’s pending messages for wait_for.
Sourcepub fn execute_load_attribute_map<T>(
self,
attribute_map: &AttributeMap<T>,
) -> Self
pub fn execute_load_attribute_map<T>( self, attribute_map: &AttributeMap<T>, ) -> Self
Loads every current instance of attribute_map for execute.
Sourcepub fn execute_load_attribute_map_instance(self, load: AttributeMapLoad) -> Self
pub fn execute_load_attribute_map_instance(self, load: AttributeMapLoad) -> Self
Loads one AttributeMap instance for execute.
Sourcepub fn execute_load_channel<T>(self, channel: &Channel<T>) -> Self
pub fn execute_load_channel<T>(self, channel: &Channel<T>) -> Self
Loads one Channel’s pending messages for execute.
Sourcepub fn execute_load_channel_map<T>(self, channel_map: &ChannelMap<T>) -> Self
pub fn execute_load_channel_map<T>(self, channel_map: &ChannelMap<T>) -> Self
Loads every current ChannelMap instance’s pending messages for execute.
Sourcepub fn execute_load_channel_map_instance(self, load: ChannelMapLoad) -> Self
pub fn execute_load_channel_map_instance(self, load: ChannelMapLoad) -> Self
Loads one ChannelMap instance’s pending messages for execute.
Trait Implementations§
Auto Trait Implementations§
impl<Input> Forget for StepOptions<Input>
impl<Input> Freeze for StepOptions<Input>
impl<Input> RefUnwindSafe for StepOptions<Input>
impl<Input> Send for StepOptions<Input>
impl<Input> Sync for StepOptions<Input>
impl<Input> Unpin for StepOptions<Input>
impl<Input> UnsafeUnpin for StepOptions<Input>
impl<Input> UnwindSafe for StepOptions<Input>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request