pub struct WorkflowContext { /* private fields */ }Implementations§
Source§impl WorkflowContext
impl WorkflowContext
pub fn activity<T: Serialize>( &self, activity_type: impl Into<String>, args: T, ) -> ActivityCall ⓘ
pub fn activity_on_queue<T, Q>( &self, activity_type: impl Into<String>, task_queue: Option<Q>, args: T, ) -> ActivityCall ⓘ
pub fn wait_signal(&self, signal_name: impl Into<String>) -> SignalCall ⓘ
Sourcepub fn sleep(&self, duration: Duration) -> TimerCall ⓘ
pub fn sleep(&self, duration: Duration) -> TimerCall ⓘ
Wait for server-backed durable time without blocking the worker executor.
Polling this future emits one start_timer command and yields. The
server records the deadline, so neither worker nor server restarts reset
the wait. Replay resolves the future only from a TimerScheduled and
TimerFired pair at the same position in the shared durable-command
stream, with matching sequence, timer identity, and delay. Sub-second
durations round up because protocol deadlines use whole seconds.
let mut worker = Worker::new(client, "rust-workers");
worker.register_workflow("delayed-greeting", |ctx, _input| async move {
ctx.sleep(Duration::from_secs(5)).await?;
Ok(json!({"status": "timer fired"}))
});Sourcepub fn start_timer(&self, duration: Duration) -> TimerCall ⓘ
pub fn start_timer(&self, duration: Duration) -> TimerCall ⓘ
Alias for WorkflowContext::sleep for timer-oriented workflow code.
Trait Implementations§
Source§impl Clone for WorkflowContext
impl Clone for WorkflowContext
Source§fn clone(&self) -> WorkflowContext
fn clone(&self) -> WorkflowContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkflowContext
impl RefUnwindSafe for WorkflowContext
impl Send for WorkflowContext
impl Sync for WorkflowContext
impl Unpin for WorkflowContext
impl UnsafeUnpin for WorkflowContext
impl UnwindSafe for WorkflowContext
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
Mutably borrows from an owned value. Read more