Skip to main content

Interface: PayloadCodec

PayloadCodec is an optional step that happens between the wire and the PayloadConverter:

Temporal Server <--> Wire <--> PayloadCodec <--> PayloadConverter <--> User code

Implement this to transform an array of Payloads to/from the format sent over the wire and stored by Temporal Server. Common transformations are encryption and compression.

Methods​

decode()​

decode(payloads, context?): Promise<IPayload[]>

Decode an array of Payloads received from the wire.

Parameters​

payloads​

IPayload[]

context?​

SerializationContext

Returns​

Promise<IPayload[]>


encode()​

encode(payloads, context?): Promise<IPayload[]>

Encode an array of Payloads for sending over the wire.

Parameters​

payloads​

IPayload[]

May have length 0.

context?​

SerializationContext

Returns​

Promise<IPayload[]>