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 { example } from './workflows';
import { nanoid } from 'nanoid';
async function run() {
// Connect to the default Server location
const connection = await Connection.connect({ address: 'localhost:7233' });
// In production, pass options to configure TLS and other settings:
// {
// address: 'foo.bar.tmprl.cloud',
// tls: {}
// }
const client = new Client({
connection,
// namespace: 'foo.bar', // connects to 'default' namespace if not specified
});
const handle = await client.workflow.start(example, {
taskQueue: 'hello-world',
// type inference works! args: [name: string]
args: ['Temporal'],
// in practice, use a meaningful business ID, like customerId or transactionId
workflowId: 'workflow-' + nanoid(),
});
console.log(`Started workflow ${handle.workflowId}`);
// optional: wait for client result
console.log(await handle.result()); // Hello, Temporal!
}
run().catch((err) => {
console.error(err);
process.exit(1);
});
Classes
- ActivityCancelledError
- ActivityCompletionError
- ActivityNotFoundError
- 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
- CompiledWorkflowOptions
- ConnectionLike
- ConnectionOptions
- 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
- TLSConfig
- WorkerBuildIdVersionSets
- WorkflowCancelInput
- WorkflowClientCallsInterceptorFactory
- WorkflowClientCallsInterceptorFactoryInput
- WorkflowClientInterceptor
- WorkflowClientInterceptors
- WorkflowClientOptions
- WorkflowDescribeInput
- WorkflowExecution
- WorkflowExecutionInfo
- WorkflowHandle
- WorkflowHandleWithFirstExecutionRunId
- WorkflowHandleWithSignaledRunId
- WorkflowOptions
- WorkflowQueryInput
- WorkflowResultOptions
- WorkflowSignalInput
- WorkflowSignalWithStartInput
- WorkflowSignalWithStartOptionsWithArgs
- WorkflowSignalWithStartOptionsWithoutArgs
- WorkflowStartInput
- 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
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