Skip to main content

WorkflowInterceptorContext

Struct WorkflowInterceptorContext 

Source
pub struct WorkflowInterceptorContext { /* private fields */ }
Expand description

Workflow execution context available to async-capable inbound interceptors.

Implementations§

Source§

impl WorkflowInterceptorContext

Source

pub fn context_value<K>(&self) -> Option<Rc<<K as WorkflowContextKey>::Value>>

Return the value associated with key type K in the current workflow context scope.

Source

pub fn with_context_value<K, F>( &self, value: <K as WorkflowContextKey>::Value, future: F, ) -> WorkflowContextFuture<F>

Poll future with value installed for key type K.

Inbound interceptors can use this to establish context around next.run(input). Outbound interceptors invoked by the workflow inside that scope observe the value with Self::context_value. The previous context is restored after each poll.

Source

pub fn with_context_value_sync<K, R>( &self, value: <K as WorkflowContextKey>::Value, f: impl FnOnce() -> R, ) -> R

Run synchronous interceptor code with value installed for key type K.

Source

pub fn workflow_id(&self) -> &str

Return the workflow’s unique identifier.

Source

pub fn run_id(&self) -> &str

Return the run id of this workflow execution.

Source

pub fn namespace(&self) -> &str

Return the namespace the workflow is executing in.

Source

pub fn task_queue(&self) -> &str

Return the task queue the workflow is executing in.

Source

pub fn workflow_type(&self) -> &str

Return the workflow type name.

Source

pub fn workflow_time(&self) -> Option<SystemTime>

Return the current time according to the workflow.

Source

pub fn history_length(&self) -> u32

Return the length of history so far at this point in the workflow.

Source

pub fn search_attributes(&self) -> SearchAttributes

Return current values for workflow search attributes.

Source

pub fn is_replaying(&self) -> bool

Returns true if the workflow is replaying (including during queries and update validators), false otherwise.

Source

pub fn is_replaying_history_events(&self) -> bool

Return true if the workflow is replaying history events (excluding queries and update validators), false otherwise.

Source

pub fn payload_converter(&self) -> &PayloadConverter

Returns the payload converter used by the worker running this workflow.

Source

pub fn cancellation_token(&self) -> WorkflowCancellationToken

Return the workflow’s root cancellation token.

Source

pub fn random_stream(&self, name: impl Into<String>) -> WorkflowRandomStream

Returns the deterministic pseudo-random stream associated with name.

Named streams let interceptors consume replay-safe randomness without changing the workflow’s default random sequence or another interceptor’s named sequence. Query and update-validator interceptors receive SyncWorkflowInterceptorContext, which does not expose random streams because those handlers are read-only.

Source

pub fn timer<T>(&self, opts: T) -> impl CancellableFuture + use<T>
where T: Into<TimerOptions>,

Request to create a timer through the workflow outbound interceptor chain.

Source

pub fn execute_activity<AD>( &self, activity: AD, input: impl Into<<AD as ActivityDefinition>::Input>, opts: ActivityOptions, ) -> impl CancellableFuture

Request to run an activity through the workflow outbound interceptor chain.

Source

pub fn execute_local_activity<AD>( &self, activity: AD, input: impl Into<<AD as ActivityDefinition>::Input>, opts: LocalActivityOptions, ) -> impl CancellableFuture

Request to run a local activity through the workflow outbound interceptor chain.

Source

pub fn start_child_workflow<WD>( &self, workflow: WD, input: impl Into<<WD as WorkflowDefinition>::Input>, opts: ChildWorkflowOptions, ) -> impl CancellableFutureWithReason

Start a child workflow through the workflow outbound interceptor chain.

Source

pub fn external_workflow( &self, workflow_id: impl Into<String>, run_id: Option<String>, ) -> ExternalWorkflowHandle

Get a handle to an external workflow for signaling or requesting cancellation.

Source§

impl WorkflowInterceptorContext

Source

pub fn start_nexus_operation( &self, opts: NexusOperationOptions, ) -> impl CancellableFuture

Start a Nexus operation through the workflow outbound interceptor chain.

Trait Implementations§

Source§

impl Clone for WorkflowInterceptorContext

Source§

fn clone(&self) -> WorkflowInterceptorContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WorkflowOutboundValue for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Access the concrete value through Any.
Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert this value into Any for a consuming downcast.