Struct WorkflowServiceClient

Source
pub struct WorkflowServiceClient<T> { /* private fields */ }
Expand description

WorkflowService API is exposed to provide support for long running applications. Application is expected to call StartWorkflowExecution to create an instance for each instance of long running workflow. Such applications are expected to have a worker which regularly polls for WorkflowTask and ActivityTask from the WorkflowService. For each WorkflowTask, application is expected to process the history of events for that session and respond back with next commands. For each ActivityTask, application is expected to execute the actual logic for that task and respond back with completion or failure. Worker is expected to regularly heartbeat while activity task is running.

Implementations§

Source§

impl WorkflowServiceClient<Channel>

Source

pub async fn connect<D>(dst: D) -> Result<Self, Error>
where D: TryInto<Endpoint>, D::Error: Into<StdError>,

Attempt to create a new client by connecting to a given endpoint.

Source§

impl<T> WorkflowServiceClient<T>
where T: GrpcService<BoxBody>, T::ResponseBody: Body + HttpBody + Send + 'static, T::Error: Into<StdError>, <T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,

Source

pub fn new(inner: T) -> Self

Source

pub fn with_interceptor(inner: T, interceptor: impl Into<Interceptor>) -> Self

Source

pub async fn register_namespace( &mut self, request: impl IntoRequest<RegisterNamespaceRequest>, ) -> Result<Response<RegisterNamespaceResponse>, Status>

RegisterNamespace creates a new namespace which can be used as a container for all resources. Namespace is a top level entity within Temporal, used as a container for all resources like workflow executions, task queues, etc. Namespace acts as a sandbox and provides isolation for all resources within the namespace. All resources belongs to exactly one namespace.

Source

pub async fn describe_namespace( &mut self, request: impl IntoRequest<DescribeNamespaceRequest>, ) -> Result<Response<DescribeNamespaceResponse>, Status>

DescribeNamespace returns the information and configuration for a registered namespace.

Source

pub async fn list_namespaces( &mut self, request: impl IntoRequest<ListNamespacesRequest>, ) -> Result<Response<ListNamespacesResponse>, Status>

ListNamespaces returns the information and configuration for all namespaces.

Source

pub async fn update_namespace( &mut self, request: impl IntoRequest<UpdateNamespaceRequest>, ) -> Result<Response<UpdateNamespaceResponse>, Status>

(– api-linter: core::0134::method-signature=disabled aip.dev/not-precedent: UpdateNamespace RPC doesn’t follow Google API format. –) (– api-linter: core::0134::response-message-name=disabled aip.dev/not-precedent: UpdateNamespace RPC doesn’t follow Google API format. –) UpdateNamespace is used to update the information and configuration for a registered namespace.

Source

pub async fn deprecate_namespace( &mut self, request: impl IntoRequest<DeprecateNamespaceRequest>, ) -> Result<Response<DeprecateNamespaceResponse>, Status>

DeprecateNamespace is used to update state of a registered namespace to DEPRECATED. Once the namespace is deprecated it cannot be used to start new workflow executions. Existing workflow executions will continue to run on deprecated namespaces.

Source

pub async fn start_workflow_execution( &mut self, request: impl IntoRequest<StartWorkflowExecutionRequest>, ) -> Result<Response<StartWorkflowExecutionResponse>, Status>

StartWorkflowExecution starts a new long running workflow instance. It will create the instance with ‘WorkflowExecutionStarted’ event in history and also schedule the first WorkflowTask for the worker to make the first command for this instance. It will return ‘WorkflowExecutionAlreadyStartedFailure’, if an instance already exists with same workflowId.

Source

pub async fn get_workflow_execution_history( &mut self, request: impl IntoRequest<GetWorkflowExecutionHistoryRequest>, ) -> Result<Response<GetWorkflowExecutionHistoryResponse>, Status>

GetWorkflowExecutionHistory returns the history of specified workflow execution. It fails with ‘NotFoundFailure’ if specified workflow execution in unknown to the service.

Source

pub async fn poll_workflow_task_queue( &mut self, request: impl IntoRequest<PollWorkflowTaskQueueRequest>, ) -> Result<Response<PollWorkflowTaskQueueResponse>, Status>

PollWorkflowTaskQueue is called by application worker to process WorkflowTask from a specific task queue. A WorkflowTask is dispatched to callers for active workflow executions, with pending workflow tasks. Application is then expected to call ‘RespondWorkflowTaskCompleted’ API when it is done processing the WorkflowTask. It will also create a ‘WorkflowTaskStarted’ event in the history for that session before handing off WorkflowTask to application worker.

Source

pub async fn respond_workflow_task_completed( &mut self, request: impl IntoRequest<RespondWorkflowTaskCompletedRequest>, ) -> Result<Response<RespondWorkflowTaskCompletedResponse>, Status>

RespondWorkflowTaskCompleted is called by application worker to complete a WorkflowTask handed as a result of ‘PollWorkflowTaskQueue’ API call. Completing a WorkflowTask will result in new events for the workflow execution and potentially new ActivityTask being created for corresponding commands. It will also create a WorkflowTaskCompleted event in the history for that session. Use the ‘taskToken’ provided as response of PollWorkflowTaskQueue API call for completing the WorkflowTask. The response could contain a new workflow task if there is one or if the request asking for one.

Source

pub async fn respond_workflow_task_failed( &mut self, request: impl IntoRequest<RespondWorkflowTaskFailedRequest>, ) -> Result<Response<RespondWorkflowTaskFailedResponse>, Status>

RespondWorkflowTaskFailed is called by application worker to indicate failure. This results in WorkflowTaskFailedEvent written to the history and a new WorkflowTask created. This API can be used by client to either clear sticky task queue or report any panics during WorkflowTask processing. Temporal will only append first WorkflowTaskFailed event to the history of workflow execution for consecutive failures.

Source

pub async fn poll_activity_task_queue( &mut self, request: impl IntoRequest<PollActivityTaskQueueRequest>, ) -> Result<Response<PollActivityTaskQueueResponse>, Status>

PollActivityTaskQueue is called by application worker to process ActivityTask from a specific task queue. ActivityTask is dispatched to callers whenever a ScheduleTask command is made for a workflow execution. Application is expected to call ‘RespondActivityTaskCompleted’ or ‘RespondActivityTaskFailed’ once it is done processing the task. Application also needs to call ‘RecordActivityTaskHeartbeat’ API within ‘heartbeatTimeoutSeconds’ interval to prevent the task from getting timed out. An event ‘ActivityTaskStarted’ event is also written to workflow execution history before the ActivityTask is dispatched to application worker.

Source

pub async fn record_activity_task_heartbeat( &mut self, request: impl IntoRequest<RecordActivityTaskHeartbeatRequest>, ) -> Result<Response<RecordActivityTaskHeartbeatResponse>, Status>

RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails to heartbeat within ‘heartbeatTimeoutSeconds’ interval for the ActivityTask, then it will be marked as timedout and ‘ActivityTaskTimedOut’ event will be written to the workflow history. Calling ‘RecordActivityTaskHeartbeat’ will fail with ‘NotFoundFailure’ in such situations. Use the ‘taskToken’ provided as response of PollActivityTaskQueue API call for heart beating.

Source

pub async fn record_activity_task_heartbeat_by_id( &mut self, request: impl IntoRequest<RecordActivityTaskHeartbeatByIdRequest>, ) -> Result<Response<RecordActivityTaskHeartbeatByIdResponse>, Status>

(– api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: “By” is used to indicate request type. –) RecordActivityTaskHeartbeatById is called by application worker while it is processing an ActivityTask. If worker fails to heartbeat within ‘heartbeatTimeoutSeconds’ interval for the ActivityTask, then it will be marked as timed out and ‘ActivityTaskTimedOut’ event will be written to the workflow history. Calling ‘RecordActivityTaskHeartbeatById’ will fail with ‘NotFoundFailure’ in such situations. Instead of using ‘taskToken’ like in RecordActivityTaskHeartbeat, use Namespace, WorkflowId and ActivityId

Source

pub async fn respond_activity_task_completed( &mut self, request: impl IntoRequest<RespondActivityTaskCompletedRequest>, ) -> Result<Response<RespondActivityTaskCompletedResponse>, Status>

RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will result in a new ‘ActivityTaskCompleted’ event being written to the workflow history and a new WorkflowTask created for the workflow so new commands could be made. Use the ‘taskToken’ provided as response of PollActivityTaskQueue API call for completion. It fails with ‘NotFoundFailure’ if the taskToken is not valid anymore due to activity timeout.

Source

pub async fn respond_activity_task_completed_by_id( &mut self, request: impl IntoRequest<RespondActivityTaskCompletedByIdRequest>, ) -> Result<Response<RespondActivityTaskCompletedByIdResponse>, Status>

(– api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: “By” is used to indicate request type. –) RespondActivityTaskCompletedById is called by application worker when it is done processing an ActivityTask. It will result in a new ‘ActivityTaskCompleted’ event being written to the workflow history and a new WorkflowTask created for the workflow so new commands could be made. Similar to RespondActivityTaskCompleted but use Namespace, WorkflowId and ActivityId instead of ‘taskToken’ for completion. It fails with ‘NotFoundFailure’ if the these Ids are not valid anymore due to activity timeout.

Source

pub async fn respond_activity_task_failed( &mut self, request: impl IntoRequest<RespondActivityTaskFailedRequest>, ) -> Result<Response<RespondActivityTaskFailedResponse>, Status>

RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will result in a new ‘ActivityTaskFailed’ event being written to the workflow history and a new WorkflowTask created for the workflow instance so new commands could be made. Use the ‘taskToken’ provided as response of PollActivityTaskQueue API call for completion. It fails with ‘NotFoundFailure’ if the taskToken is not valid anymore due to activity timeout.

Source

pub async fn respond_activity_task_failed_by_id( &mut self, request: impl IntoRequest<RespondActivityTaskFailedByIdRequest>, ) -> Result<Response<RespondActivityTaskFailedByIdResponse>, Status>

(– api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: “By” is used to indicate request type. –) RespondActivityTaskFailedById is called by application worker when it is done processing an ActivityTask. It will result in a new ‘ActivityTaskFailed’ event being written to the workflow history and a new WorkflowTask created for the workflow instance so new commands could be made. Similar to RespondActivityTaskFailed but use Namespace, WorkflowId and ActivityId instead of ‘taskToken’ for completion. It fails with ‘NotFoundFailure’ if the these Ids are not valid anymore due to activity timeout.

Source

pub async fn respond_activity_task_canceled( &mut self, request: impl IntoRequest<RespondActivityTaskCanceledRequest>, ) -> Result<Response<RespondActivityTaskCanceledResponse>, Status>

RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will result in a new ‘ActivityTaskCanceled’ event being written to the workflow history and a new WorkflowTask created for the workflow instance so new commands could be made. Use the ‘taskToken’ provided as response of PollActivityTaskQueue API call for completion. It fails with ‘NotFoundFailure’ if the taskToken is not valid anymore due to activity timeout.

Source

pub async fn respond_activity_task_canceled_by_id( &mut self, request: impl IntoRequest<RespondActivityTaskCanceledByIdRequest>, ) -> Result<Response<RespondActivityTaskCanceledByIdResponse>, Status>

(– api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: “By” is used to indicate request type. –) RespondActivityTaskCanceledById is called by application worker when it is successfully canceled an ActivityTask. It will result in a new ‘ActivityTaskCanceled’ event being written to the workflow history and a new WorkflowTask created for the workflow instance so new commands could be made. Similar to RespondActivityTaskCanceled but use Namespace, WorkflowId and ActivityId instead of ‘taskToken’ for completion. It fails with ‘NotFoundFailure’ if the these Ids are not valid anymore due to activity timeout.

Source

pub async fn request_cancel_workflow_execution( &mut self, request: impl IntoRequest<RequestCancelWorkflowExecutionRequest>, ) -> Result<Response<RequestCancelWorkflowExecutionResponse>, Status>

RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance. It will result in a new ‘WorkflowExecutionCancelRequested’ event being written to the workflow history and a new WorkflowTask created for the workflow instance so new commands could be made. It fails with ‘NotFoundFailure’ if the workflow is not valid anymore due to completion or doesn’t exist.

Source

pub async fn signal_workflow_execution( &mut self, request: impl IntoRequest<SignalWorkflowExecutionRequest>, ) -> Result<Response<SignalWorkflowExecutionResponse>, Status>

SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in WorkflowExecutionSignaled event recorded in the history and a workflow task being created for the execution.

Source

pub async fn signal_with_start_workflow_execution( &mut self, request: impl IntoRequest<SignalWithStartWorkflowExecutionRequest>, ) -> Result<Response<SignalWithStartWorkflowExecutionResponse>, Status>

(– api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: “With” is used to indicate combined operation. –) SignalWithStartWorkflowExecution is used to ensure sending signal to a workflow. If the workflow is running, this results in WorkflowExecutionSignaled event being recorded in the history and a workflow task being created for the execution. If the workflow is not running or not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled events being recorded in history, and a workflow task being created for the execution

Source

pub async fn reset_workflow_execution( &mut self, request: impl IntoRequest<ResetWorkflowExecutionRequest>, ) -> Result<Response<ResetWorkflowExecutionResponse>, Status>

ResetWorkflowExecution reset an existing workflow execution to WorkflowTaskCompleted event(exclusive). And it will immediately terminating the current execution instance.

Source

pub async fn terminate_workflow_execution( &mut self, request: impl IntoRequest<TerminateWorkflowExecutionRequest>, ) -> Result<Response<TerminateWorkflowExecutionResponse>, Status>

TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event in the history and immediately terminating the execution instance.

Source

pub async fn list_open_workflow_executions( &mut self, request: impl IntoRequest<ListOpenWorkflowExecutionsRequest>, ) -> Result<Response<ListOpenWorkflowExecutionsResponse>, Status>

ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific namespace.

Source

pub async fn list_closed_workflow_executions( &mut self, request: impl IntoRequest<ListClosedWorkflowExecutionsRequest>, ) -> Result<Response<ListClosedWorkflowExecutionsResponse>, Status>

ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific namespace.

Source

pub async fn list_workflow_executions( &mut self, request: impl IntoRequest<ListWorkflowExecutionsRequest>, ) -> Result<Response<ListWorkflowExecutionsResponse>, Status>

ListWorkflowExecutions is a visibility API to list workflow executions in a specific namespace.

Source

pub async fn list_archived_workflow_executions( &mut self, request: impl IntoRequest<ListArchivedWorkflowExecutionsRequest>, ) -> Result<Response<ListArchivedWorkflowExecutionsResponse>, Status>

ListArchivedWorkflowExecutions is a visibility API to list archived workflow executions in a specific namespace.

Source

pub async fn scan_workflow_executions( &mut self, request: impl IntoRequest<ScanWorkflowExecutionsRequest>, ) -> Result<Response<ScanWorkflowExecutionsResponse>, Status>

ScanWorkflowExecutions is a visibility API to list large amount of workflow executions in a specific namespace without order.

Source

pub async fn count_workflow_executions( &mut self, request: impl IntoRequest<CountWorkflowExecutionsRequest>, ) -> Result<Response<CountWorkflowExecutionsResponse>, Status>

CountWorkflowExecutions is a visibility API to count of workflow executions in a specific namespace.

Source

pub async fn get_search_attributes( &mut self, request: impl IntoRequest<GetSearchAttributesRequest>, ) -> Result<Response<GetSearchAttributesResponse>, Status>

GetSearchAttributes is a visibility API to get all legal keys that could be used in list APIs

Source

pub async fn respond_query_task_completed( &mut self, request: impl IntoRequest<RespondQueryTaskCompletedRequest>, ) -> Result<Response<RespondQueryTaskCompletedResponse>, Status>

RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a WorkflowTask for query) as a result of ‘PollWorkflowTaskQueue’ API call. Completing a QueryTask will unblock the client call to ‘QueryWorkflow’ API and return the query result to client as a response to ‘QueryWorkflow’ API call.

Source

pub async fn reset_sticky_task_queue( &mut self, request: impl IntoRequest<ResetStickyTaskQueueRequest>, ) -> Result<Response<ResetStickyTaskQueueResponse>, Status>

ResetStickyTaskQueue resets the sticky task queue related information in mutable state of a given workflow. Things cleared are:

  1. StickyTaskQueue
  2. StickyScheduleToStartTimeout
Source

pub async fn query_workflow( &mut self, request: impl IntoRequest<QueryWorkflowRequest>, ) -> Result<Response<QueryWorkflowResponse>, Status>

QueryWorkflow returns query result for a specified workflow execution

Source

pub async fn describe_workflow_execution( &mut self, request: impl IntoRequest<DescribeWorkflowExecutionRequest>, ) -> Result<Response<DescribeWorkflowExecutionResponse>, Status>

DescribeWorkflowExecution returns information about the specified workflow execution.

Source

pub async fn describe_task_queue( &mut self, request: impl IntoRequest<DescribeTaskQueueRequest>, ) -> Result<Response<DescribeTaskQueueResponse>, Status>

DescribeTaskQueue returns information about the target task queue, right now this API returns the pollers which polled this task queue in last few minutes.

Source

pub async fn get_cluster_info( &mut self, request: impl IntoRequest<GetClusterInfoRequest>, ) -> Result<Response<GetClusterInfoResponse>, Status>

GetClusterInfo returns information about temporal cluster

Source

pub async fn list_task_queue_partitions( &mut self, request: impl IntoRequest<ListTaskQueuePartitionsRequest>, ) -> Result<Response<ListTaskQueuePartitionsResponse>, Status>

Trait Implementations§

Source§

impl<T: Clone> Clone for WorkflowServiceClient<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for WorkflowServiceClient<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for WorkflowServiceClient<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for WorkflowServiceClient<T>

§

impl<T> Send for WorkflowServiceClient<T>
where T: Send,

§

impl<T> Sync for WorkflowServiceClient<T>
where T: Sync,

§

impl<T> Unpin for WorkflowServiceClient<T>
where T: Unpin,

§

impl<T> !UnwindSafe for WorkflowServiceClient<T>

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> 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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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> 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> ErasedDestructor for T
where T: 'static,