Skip to main content

Class: NativeConnection

worker.NativeConnection

A Native Connection object that delegates calls to the Rust Core binary extension.

A Worker must use this class to connect to the server.

Do not confuse this connection class with @temporalio/client's Connection.

Methods

close

close(): Promise<void>

Close this connection.

Make sure any Workers using this connection are stopped before calling this method or it will throw an IllegalStateError

Returns

Promise<void>


setApiKey

setApiKey(apiKey): Promise<void>

Update the API key for this client. This is only set if metadata doesn't already have an "authorization" key.

Use NativeConnectionOptions.apiKey to set the initial metadata for client creation.

Parameters

NameType
apiKeystring

Returns

Promise<void>


setMetadata

setMetadata(metadata): Promise<void>

Mapping of gRPC metadata (HTTP headers) to send with each request to the server.

Use NativeConnectionOptions.metadata to set the initial metadata for client creation.

Parameters

NameType
metadataRecord<string, string>

Returns

Promise<void>


connect

connect(options?): Promise<NativeConnection>

Eagerly connect to the Temporal server and return a NativeConnection instance

Parameters

NameType
options?NativeConnectionOptions

Returns

Promise<NativeConnection>


create

create(options?): Promise<NativeConnection>

Parameters

NameType
options?NativeConnectionOptions

Returns

Promise<NativeConnection>

Deprecated

use connect instead