Skip to main content

ClientInterceptor

Trait ClientInterceptor 

Source
pub trait ClientInterceptor:
    Send
    + Sync
    + 'static {
Show 25 methods // Provided methods fn start_workflow<'a>( &'a self, input: StartWorkflowInput, next: Next<'a, StartWorkflowInput, BoxFuture<'a, Result<StartWorkflowOutput, WorkflowStartError>>>, ) -> BoxFuture<'a, Result<StartWorkflowOutput, WorkflowStartError>> { ... } fn list_workflows_page<'a>( &'a self, input: ListWorkflowsPageInput, next: Next<'a, ListWorkflowsPageInput, BoxFuture<'a, Result<ListWorkflowsPageOutput, ClientError>>>, ) -> BoxFuture<'a, Result<ListWorkflowsPageOutput, ClientError>> { ... } fn count_workflows<'a>( &'a self, input: CountWorkflowsInput, next: Next<'a, CountWorkflowsInput, BoxFuture<'a, Result<CountWorkflowsOutput, ClientError>>>, ) -> BoxFuture<'a, Result<CountWorkflowsOutput, ClientError>> { ... } fn describe_workflow<'a>( &'a self, input: DescribeWorkflowInput, next: Next<'a, DescribeWorkflowInput, BoxFuture<'a, Result<DescribeWorkflowOutput, WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<DescribeWorkflowOutput, WorkflowInteractionError>> { ... } fn fetch_workflow_history_page<'a>( &'a self, input: FetchWorkflowHistoryPageInput, next: Next<'a, FetchWorkflowHistoryPageInput, BoxFuture<'a, Result<FetchWorkflowHistoryPageOutput, WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<FetchWorkflowHistoryPageOutput, WorkflowInteractionError>> { ... } fn signal_workflow<'a>( &'a self, input: SignalWorkflowInput, next: Next<'a, SignalWorkflowInput, BoxFuture<'a, Result<(), WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<(), WorkflowInteractionError>> { ... } fn query_workflow<'a>( &'a self, input: QueryWorkflowInput, next: Next<'a, QueryWorkflowInput, BoxFuture<'a, Result<QueryWorkflowOutput, WorkflowQueryError>>>, ) -> BoxFuture<'a, Result<QueryWorkflowOutput, WorkflowQueryError>> { ... } fn start_workflow_update<'a>( &'a self, input: StartWorkflowUpdateInput, next: Next<'a, StartWorkflowUpdateInput, BoxFuture<'a, Result<StartWorkflowUpdateOutput, WorkflowUpdateError>>>, ) -> BoxFuture<'a, Result<StartWorkflowUpdateOutput, WorkflowUpdateError>> { ... } fn poll_workflow_update<'a>( &'a self, input: PollWorkflowUpdateInput, next: Next<'a, PollWorkflowUpdateInput, BoxFuture<'a, Result<PollWorkflowUpdateOutput, WorkflowUpdateError>>>, ) -> BoxFuture<'a, Result<PollWorkflowUpdateOutput, WorkflowUpdateError>> { ... } fn cancel_workflow<'a>( &'a self, input: CancelWorkflowInput, next: Next<'a, CancelWorkflowInput, BoxFuture<'a, Result<(), WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<(), WorkflowInteractionError>> { ... } fn terminate_workflow<'a>( &'a self, input: TerminateWorkflowInput, next: Next<'a, TerminateWorkflowInput, BoxFuture<'a, Result<(), WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<(), WorkflowInteractionError>> { ... } fn create_schedule<'a>( &'a self, input: CreateScheduleInput, next: Next<'a, CreateScheduleInput, BoxFuture<'a, Result<CreateScheduleOutput, ScheduleError>>>, ) -> BoxFuture<'a, Result<CreateScheduleOutput, ScheduleError>> { ... } fn list_schedules_page<'a>( &'a self, input: ListSchedulesPageInput, next: Next<'a, ListSchedulesPageInput, BoxFuture<'a, Result<ListSchedulesPageOutput, ScheduleError>>>, ) -> BoxFuture<'a, Result<ListSchedulesPageOutput, ScheduleError>> { ... } fn describe_schedule<'a>( &'a self, input: DescribeScheduleInput, next: Next<'a, DescribeScheduleInput, BoxFuture<'a, Result<DescribeScheduleOutput, ScheduleError>>>, ) -> BoxFuture<'a, Result<DescribeScheduleOutput, ScheduleError>> { ... } fn update_schedule<'a>( &'a self, input: UpdateScheduleInput, next: Next<'a, UpdateScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn send_schedule_update<'a>( &'a self, input: SendScheduleUpdateInput, next: Next<'a, SendScheduleUpdateInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn delete_schedule<'a>( &'a self, input: DeleteScheduleInput, next: Next<'a, DeleteScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn pause_schedule<'a>( &'a self, input: PauseScheduleInput, next: Next<'a, PauseScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn unpause_schedule<'a>( &'a self, input: UnpauseScheduleInput, next: Next<'a, UnpauseScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn trigger_schedule<'a>( &'a self, input: TriggerScheduleInput, next: Next<'a, TriggerScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn backfill_schedule<'a>( &'a self, input: BackfillScheduleInput, next: Next<'a, BackfillScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>> { ... } fn complete_async_activity<'a>( &'a self, input: CompleteAsyncActivityInput, next: Next<'a, CompleteAsyncActivityInput, BoxFuture<'a, Result<(), AsyncActivityError>>>, ) -> BoxFuture<'a, Result<(), AsyncActivityError>> { ... } fn fail_async_activity<'a>( &'a self, input: FailAsyncActivityInput, next: Next<'a, FailAsyncActivityInput, BoxFuture<'a, Result<(), AsyncActivityError>>>, ) -> BoxFuture<'a, Result<(), AsyncActivityError>> { ... } fn report_async_activity_cancellation<'a>( &'a self, input: ReportAsyncActivityCancellationInput, next: Next<'a, ReportAsyncActivityCancellationInput, BoxFuture<'a, Result<(), AsyncActivityError>>>, ) -> BoxFuture<'a, Result<(), AsyncActivityError>> { ... } fn heartbeat_async_activity<'a>( &'a self, input: HeartbeatAsyncActivityInput, next: Next<'a, HeartbeatAsyncActivityInput, BoxFuture<'a, Result<ActivityHeartbeatResponse, AsyncActivityError>>>, ) -> BoxFuture<'a, Result<ActivityHeartbeatResponse, AsyncActivityError>> { ... }
}
Expand description

Intercepts high-level client operations.

The first interceptor configured on a client is the outermost interceptor. An interceptor can do asynchronous work before and after calling next, mutate or replace typed input, or return without calling next to short-circuit the operation.

use futures_util::future::BoxFuture;
use std::{sync::Arc, time::Duration};
use temporalio_client::{
    ClientInterceptor, ClientOptions, Next, StartWorkflowInput, StartWorkflowOutput,
    errors::WorkflowStartError,
};

struct StartTimeout;

impl ClientInterceptor for StartTimeout {
    fn start_workflow<'a>(
        &'a self,
        mut input: StartWorkflowInput,
        next: Next<
            'a,
            StartWorkflowInput,
            BoxFuture<'a, Result<StartWorkflowOutput, WorkflowStartError>>,
        >,
    ) -> BoxFuture<'a, Result<StartWorkflowOutput, WorkflowStartError>> {
        Box::pin(async move {
            input.rpc_options.timeout = Some(Duration::from_secs(10));
            let output = next.run(input).await?;
            Ok(output)
        })
    }
}

let _options = ClientOptions::new("my-namespace")
    .client_interceptors(vec![Arc::new(StartTimeout)])
    .build();

Provided Methods§

Source

fn start_workflow<'a>( &'a self, input: StartWorkflowInput, next: Next<'a, StartWorkflowInput, BoxFuture<'a, Result<StartWorkflowOutput, WorkflowStartError>>>, ) -> BoxFuture<'a, Result<StartWorkflowOutput, WorkflowStartError>>

Intercept a start_workflow operation.

Source

fn list_workflows_page<'a>( &'a self, input: ListWorkflowsPageInput, next: Next<'a, ListWorkflowsPageInput, BoxFuture<'a, Result<ListWorkflowsPageOutput, ClientError>>>, ) -> BoxFuture<'a, Result<ListWorkflowsPageOutput, ClientError>>

Intercept a list_workflows_page operation.

Source

fn count_workflows<'a>( &'a self, input: CountWorkflowsInput, next: Next<'a, CountWorkflowsInput, BoxFuture<'a, Result<CountWorkflowsOutput, ClientError>>>, ) -> BoxFuture<'a, Result<CountWorkflowsOutput, ClientError>>

Intercept a count_workflows operation.

Source

fn describe_workflow<'a>( &'a self, input: DescribeWorkflowInput, next: Next<'a, DescribeWorkflowInput, BoxFuture<'a, Result<DescribeWorkflowOutput, WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<DescribeWorkflowOutput, WorkflowInteractionError>>

Intercept a describe_workflow operation.

Source

fn fetch_workflow_history_page<'a>( &'a self, input: FetchWorkflowHistoryPageInput, next: Next<'a, FetchWorkflowHistoryPageInput, BoxFuture<'a, Result<FetchWorkflowHistoryPageOutput, WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<FetchWorkflowHistoryPageOutput, WorkflowInteractionError>>

Intercept a fetch_workflow_history_page operation.

Source

fn signal_workflow<'a>( &'a self, input: SignalWorkflowInput, next: Next<'a, SignalWorkflowInput, BoxFuture<'a, Result<(), WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<(), WorkflowInteractionError>>

Intercept a signal_workflow operation.

Source

fn query_workflow<'a>( &'a self, input: QueryWorkflowInput, next: Next<'a, QueryWorkflowInput, BoxFuture<'a, Result<QueryWorkflowOutput, WorkflowQueryError>>>, ) -> BoxFuture<'a, Result<QueryWorkflowOutput, WorkflowQueryError>>

Intercept a query_workflow operation.

Source

fn start_workflow_update<'a>( &'a self, input: StartWorkflowUpdateInput, next: Next<'a, StartWorkflowUpdateInput, BoxFuture<'a, Result<StartWorkflowUpdateOutput, WorkflowUpdateError>>>, ) -> BoxFuture<'a, Result<StartWorkflowUpdateOutput, WorkflowUpdateError>>

Intercept a start_workflow_update operation.

Source

fn poll_workflow_update<'a>( &'a self, input: PollWorkflowUpdateInput, next: Next<'a, PollWorkflowUpdateInput, BoxFuture<'a, Result<PollWorkflowUpdateOutput, WorkflowUpdateError>>>, ) -> BoxFuture<'a, Result<PollWorkflowUpdateOutput, WorkflowUpdateError>>

Intercept a poll_workflow_update operation.

Source

fn cancel_workflow<'a>( &'a self, input: CancelWorkflowInput, next: Next<'a, CancelWorkflowInput, BoxFuture<'a, Result<(), WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<(), WorkflowInteractionError>>

Intercept a cancel_workflow operation.

Source

fn terminate_workflow<'a>( &'a self, input: TerminateWorkflowInput, next: Next<'a, TerminateWorkflowInput, BoxFuture<'a, Result<(), WorkflowInteractionError>>>, ) -> BoxFuture<'a, Result<(), WorkflowInteractionError>>

Intercept a terminate_workflow operation.

Source

fn create_schedule<'a>( &'a self, input: CreateScheduleInput, next: Next<'a, CreateScheduleInput, BoxFuture<'a, Result<CreateScheduleOutput, ScheduleError>>>, ) -> BoxFuture<'a, Result<CreateScheduleOutput, ScheduleError>>

Intercept a create_schedule operation.

Source

fn list_schedules_page<'a>( &'a self, input: ListSchedulesPageInput, next: Next<'a, ListSchedulesPageInput, BoxFuture<'a, Result<ListSchedulesPageOutput, ScheduleError>>>, ) -> BoxFuture<'a, Result<ListSchedulesPageOutput, ScheduleError>>

Intercept a list_schedules_page operation.

Source

fn describe_schedule<'a>( &'a self, input: DescribeScheduleInput, next: Next<'a, DescribeScheduleInput, BoxFuture<'a, Result<DescribeScheduleOutput, ScheduleError>>>, ) -> BoxFuture<'a, Result<DescribeScheduleOutput, ScheduleError>>

Intercept a describe_schedule operation.

Source

fn update_schedule<'a>( &'a self, input: UpdateScheduleInput, next: Next<'a, UpdateScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept an update_schedule operation.

Source

fn send_schedule_update<'a>( &'a self, input: SendScheduleUpdateInput, next: Next<'a, SendScheduleUpdateInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept a send_schedule_update operation.

Source

fn delete_schedule<'a>( &'a self, input: DeleteScheduleInput, next: Next<'a, DeleteScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept a delete_schedule operation.

Source

fn pause_schedule<'a>( &'a self, input: PauseScheduleInput, next: Next<'a, PauseScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept a pause_schedule operation.

Source

fn unpause_schedule<'a>( &'a self, input: UnpauseScheduleInput, next: Next<'a, UnpauseScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept an unpause_schedule operation.

Source

fn trigger_schedule<'a>( &'a self, input: TriggerScheduleInput, next: Next<'a, TriggerScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept a trigger_schedule operation.

Source

fn backfill_schedule<'a>( &'a self, input: BackfillScheduleInput, next: Next<'a, BackfillScheduleInput, BoxFuture<'a, Result<(), ScheduleError>>>, ) -> BoxFuture<'a, Result<(), ScheduleError>>

Intercept a backfill_schedule operation.

Source

fn complete_async_activity<'a>( &'a self, input: CompleteAsyncActivityInput, next: Next<'a, CompleteAsyncActivityInput, BoxFuture<'a, Result<(), AsyncActivityError>>>, ) -> BoxFuture<'a, Result<(), AsyncActivityError>>

Intercept a complete_async_activity operation.

Source

fn fail_async_activity<'a>( &'a self, input: FailAsyncActivityInput, next: Next<'a, FailAsyncActivityInput, BoxFuture<'a, Result<(), AsyncActivityError>>>, ) -> BoxFuture<'a, Result<(), AsyncActivityError>>

Intercept a fail_async_activity operation.

Source

fn report_async_activity_cancellation<'a>( &'a self, input: ReportAsyncActivityCancellationInput, next: Next<'a, ReportAsyncActivityCancellationInput, BoxFuture<'a, Result<(), AsyncActivityError>>>, ) -> BoxFuture<'a, Result<(), AsyncActivityError>>

Intercept a report_async_activity_cancellation operation.

Source

fn heartbeat_async_activity<'a>( &'a self, input: HeartbeatAsyncActivityInput, next: Next<'a, HeartbeatAsyncActivityInput, BoxFuture<'a, Result<ActivityHeartbeatResponse, AsyncActivityError>>>, ) -> BoxFuture<'a, Result<ActivityHeartbeatResponse, AsyncActivityError>>

Intercept a heartbeat_async_activity operation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§