Namespace: client
Client for communicating with Temporal Server.
Most functionality is available through WorkflowClient, but you can also call gRPC methods directly using Connection.workflowService and Connection.operatorService.
Usage
import { Connection, Client } from '@temporalio/client';
import { loadClientConnectConfig } from '@temporalio/envconfig';
import { sleepForDays } from './workflows';
import { nanoid } from 'nanoid';
async function run() {
const config = loadClientConnectConfig();
const connection = await Connection.connect(config.connectionOptions);
const client = new Client({ connection });
const handle = await client.workflow.start(sleepForDays, {
taskQueue: 'sleep-for-days',
workflowId: 'workflow-' + nanoid(),
});
console.log(`Started workflow ${handle.workflowId}`);
// Wait for workflow completion (runs indefinitely until it receives a signal)
console.log(await handle.result());
}
run().catch((err) => {
console.error(err);
process.exit(1);
});
Classes
- ActivityCancelledError
- ActivityClient
- ActivityCompletionError
- ActivityExecutionAlreadyStartedError
- ActivityExecutionFailedError
- ActivityNotFoundError
- ActivityPausedError
- ActivityResetError
- AsyncCompletionClient
- BuildIdNotFoundError
- Client
- Connection
- NexusClient
- NexusOperationAlreadyStartedError
- NexusOperationFailureError
- NexusOperationNotFoundError
- QueryNotRegisteredError
- QueryRejectedError
- ScheduleAlreadyRunning
- ScheduleClient
- ScheduleNotFoundError
- ServiceError
- TaskQueueClient
- WithStartWorkflowOperation
- WorkflowClient
- WorkflowContinuedAsNewError
- WorkflowFailedError
- WorkflowUpdateFailedError
- WorkflowUpdateRPCTimeoutOrCancelledError
Interfaces
- ActivityCancelInput
- ActivityClientInterceptor
- ActivityClientOptions
- ActivityCountInput
- ActivityDescribeInput
- ActivityExecutionDescription
- ActivityExecutionInfo
- ActivityGetResultInput
- ActivityHandle
- ActivityListInput
- ActivityOptions
- ActivityStartInput
- ActivityTerminateInput
- AddNewCompatibleVersion
- AddNewIdInNewDefaultSet
- AsyncCompletionOperationOptions
- AsyncWorkflowListIterable
- Backfill
- BackoffOptions
- BaseReachabilityOptions
- BuildIdReachability
- BuildIdVersionSet
- CalendarSpec
- CalendarSpecDescription
- CallContext
- CancelNexusOperationInput
- ClientInterceptors
- ClientOptions
- ClientPlugin
- CompiledWorkflowOptions
- ConnectionLike
- ConnectionOptions
- ConnectionPlugin
- CountActivityExecutions
- CountNexusOperationsInput
- CountWorkflowExecution
- CreateScheduleInput
- DescribeNexusOperationInput
- DescribeNexusOperationOptions
- FullActivityId
- GetNexusOperationHandleOptions
- GetNexusOperationResultInput
- GetWorkflowHandleOptions
- GetWorkflowUpdateHandleOptions
- GrpcRetryOptions
- IntervalSpec
- IntervalSpecDescription
- IntoHistoriesOptions
- ListNexusOperationsInput
- ListNexusOperationsOptions
- ListOptions
- ListScheduleOptions
- MergeSets
- NexusClientInterceptor
- NexusClientOptions
- NexusOperationExecution
- NexusOperationExecutionCancellationInfo
- NexusOperationExecutionCount
- NexusOperationExecutionCountGroup
- NexusOperationHandle
- NexusServiceClient
- PromoteBuildIdWithinSet
- PromoteSetByBuildId
- Range
- ReachabilityResponse
- ScheduleClientInterceptor
- ScheduleClientOptions
- ScheduleExecutionResult
- ScheduleExecutionStartWorkflowActionResult
- ScheduleHandle
- ScheduleOptions
- ScheduleSpec
- ScheduleSummary
- ScheduleSummaryStartWorkflowAction
- StartNexusOperationInput
- StartNexusOperationOptions
- TerminateNexusOperationInput
- TypedActivityClient
- WorkerBuildIdVersionSets
- WorkflowCancelInput
- WorkflowClientCallsInterceptorFactory
- WorkflowClientCallsInterceptorFactoryInput
- WorkflowClientInterceptor
- WorkflowClientInterceptors
- WorkflowClientOptions
- WorkflowDescribeInput
- WorkflowExecution
- WorkflowExecutionInfo
- WorkflowHandle
- WorkflowHandleWithFirstExecutionRunId
- WorkflowHandleWithSignaledRunId
- WorkflowHandleWithStartDetails
- WorkflowOptions
- WorkflowQueryInput
- WorkflowResultOptions
- WorkflowSignalInput
- WorkflowSignalWithStartInput
- WorkflowSignalWithStartOptionsWithArgs
- WorkflowSignalWithStartOptionsWithoutArgs
- WorkflowStartInput
- WorkflowStartOutput
- WorkflowStartUpdateInput
- WorkflowStartUpdateOutput
- WorkflowStartUpdateWithStartInput
- WorkflowStartUpdateWithStartOutput
- WorkflowTerminateInput
- WorkflowUpdateHandle
- WorkflowUpdateOptions
References
ActivityFailure
Re-exports ActivityFailure
ActivityFunction
Re-exports ActivityFunction
ActivityInterface
Re-exports ActivityInterface
ApplicationFailure
Re-exports ApplicationFailure
BaseWorkflowHandle
Re-exports BaseWorkflowHandle
BaseWorkflowOptions
Re-exports BaseWorkflowOptions
CancelledFailure
Re-exports CancelledFailure
ChildWorkflowFailure
Re-exports ChildWorkflowFailure
CommonWorkflowOptions
Re-exports CommonWorkflowOptions
CompleteAsyncError
Re-exports CompleteAsyncError
DataConverter
Re-exports DataConverter
HandlerUnfinishedPolicy
Re-exports HandlerUnfinishedPolicy
Headers
Re-exports Headers
HistoryAndWorkflowId
Re-exports HistoryAndWorkflowId
IllegalStateError
Re-exports IllegalStateError
NamespaceNotFoundError
Re-exports NamespaceNotFoundError
Next
Re-exports Next
Payload
Re-exports Payload
PayloadConverterError
Re-exports PayloadConverterError
ProtoFailure
Re-exports ProtoFailure
QueryDefinition
Re-exports QueryDefinition
RetryPolicy
Re-exports RetryPolicy
ServerFailure
Re-exports ServerFailure
SignalDefinition
Re-exports SignalDefinition
TLSConfig
Re-exports TLSConfig
TemporalFailure
Re-exports TemporalFailure
TerminatedFailure
Re-exports TerminatedFailure
TimeoutFailure
Re-exports TimeoutFailure
UntypedActivities
Re-exports UntypedActivities
UpdateDefinition
Re-exports UpdateDefinition
ValueError
Re-exports ValueError
WithWorkflowArgs
Re-exports WithWorkflowArgs
Workflow
Re-exports Workflow