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
- ActivityCompletionError
- ActivityNotFoundError
- ActivityPausedError
- ActivityResetError
- AsyncCompletionClient
- BuildIdNotFoundError
- Client
- Connection
- QueryNotRegisteredError
- QueryRejectedError
- ScheduleAlreadyRunning
- ScheduleClient
- ScheduleNotFoundError
- ServiceError
- TaskQueueClient
- WithStartWorkflowOperation
- WorkflowClient
- WorkflowContinuedAsNewError
- WorkflowFailedError
- WorkflowUpdateFailedError
- WorkflowUpdateRPCTimeoutOrCancelledError
Interfaces
- AddNewCompatibleVersion
- AddNewIdInNewDefaultSet
- AsyncWorkflowListIterable
- Backfill
- BackoffOptions
- BaseReachabilityOptions
- BuildIdReachability
- BuildIdVersionSet
- CalendarSpec
- CalendarSpecDescription
- CallContext
- ClientInterceptors
- ClientOptions
- ClientPlugin
- CompiledWorkflowOptions
- ConnectionLike
- ConnectionOptions
- ConnectionPlugin
- CountWorkflowExecution
- CreateScheduleInput
- FullActivityId
- GetWorkflowHandleOptions
- GetWorkflowUpdateHandleOptions
- GrpcRetryOptions
- IntervalSpec
- IntervalSpecDescription
- IntoHistoriesOptions
- ListOptions
- ListScheduleOptions
- MergeSets
- PromoteBuildIdWithinSet
- PromoteSetByBuildId
- Range
- ReachabilityResponse
- ScheduleClientInterceptor
- ScheduleClientOptions
- ScheduleExecutionResult
- ScheduleExecutionStartWorkflowActionResult
- ScheduleHandle
- ScheduleOptions
- ScheduleSpec
- ScheduleSummary
- ScheduleSummaryStartWorkflowAction
- 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