Skip to main content

Namespace: worker

The temporal worker connects to the service and runs workflows and activities.

Usage#

Namespaces#

Classes#

Interfaces#

Type aliases#

Headers#

Ƭ Headers: Record<string, IPayload>

Headers are just a mapping of header name to Payload


InjectedDependencies#

Ƭ InjectedDependencies<T>: { [P in keyof T]: InjectedDependency<T[P]>}

Converts a ExternalDependencies interface from a mapping of name to ExternalDependency to a mapping of name to InjectedDependency.

Used for type checking Workflow external dependency injection.

Type parameters#

NameType
Textends ExternalDependencies

InjectedDependency#

Ƭ InjectedDependency<T>: { [P in keyof T]: InjectedDependencyFunction<T[P]>}

Converts a ExternalDependency from a mapping of name to function to a mapping of name to InjectedDependencyFunction

Type parameters#

NameType
Textends ExternalDependency

LogLevel#

Ƭ LogLevel: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR"

Log level - must match rust log level names


LogMetadata#

Ƭ LogMetadata: Record<string | symbol, any>


Next#

Ƭ Next<IF, FN>: Required<IF>[FN] extends AnyFunc ? OmitLastParam<Required<IF>[FN]> : never

Type of the next function for a given interceptor function

Called from an interceptor to continue the interception chain

Type parameters#

NameType
IFIF
FNextends keyof IF

State#

Ƭ State: "INITIALIZED" | "RUNNING" | "STOPPED" | "STOPPING" | "DRAINING" | "DRAINED" | "FAILED"

The worker's possible states

  • INITIALIZED - The initial state of the Worker after calling Worker.create and successful connection to the server
  • RUNNING - Worker.run was called, polling task queues
  • STOPPING - Worker.shutdown was called or received shutdown signal, worker will forcefully shutdown in shutdownGraceTime
  • DRAINING - Core has indicated that shutdown is complete and all Workflow tasks have been drained, waiting for activities and cached workflows eviction
  • DRAINED - All activities and workflows have completed, ready to shutdown
  • STOPPED - Shutdown complete, Worker.run resolves
  • FAILED - Worker encountered an unrecoverable error, Worker.run should reject with the error

TLSConfig#

Ƭ TLSConfig: TLSConfig

Variables#

LogTimestamp#

Const LogTimestamp: unique symbol


defaultDataConverter#

Const defaultDataConverter: CompositeDataConverter

Functions#

timeOfDayToBigint#

timeOfDayToBigint(__namedParameters): bigint

Takes a [seconds, nanos] tuple as returned from getTimeOfDay and turns it into bigint.

Parameters#

NameType
__namedParameters[number, number]

Returns#

bigint