Interface PayloadCodec

All Known Implementing Classes:
ChainCodec, CodecDataConverter, ZlibPayloadCodec

public interface PayloadCodec
Codec that encodes or decodes the given payloads. PayloadCodec implementation may be used in CodecDataConverter or server side in a Remote Data Encoder implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.temporal.api.common.v1.Payload>
    decode(List<io.temporal.api.common.v1.Payload> payloads)
     
    List<io.temporal.api.common.v1.Payload>
    encode(List<io.temporal.api.common.v1.Payload> payloads)
     
    default PayloadCodec
    A correct implementation of this interface should have a fully functional "contextless" implementation.
  • Method Details

    • encode

      @Nonnull List<io.temporal.api.common.v1.Payload> encode(@Nonnull List<io.temporal.api.common.v1.Payload> payloads)
    • decode

      @Nonnull List<io.temporal.api.common.v1.Payload> decode(@Nonnull List<io.temporal.api.common.v1.Payload> payloads)
    • withContext

      @Experimental @Nonnull default PayloadCodec withContext(@Nonnull SerializationContext context)
      A correct implementation of this interface should have a fully functional "contextless" implementation. Temporal SDK will call this method when a knowledge of the context exists, but DataConverter can be used directly by user code and sometimes SDK itself without any context.

      Note: this method is expected to be cheap and fast. Temporal SDK doesn't always cache the instances and may be calling this method very often. Users are responsible to make sure that this method doesn't recreate expensive objects like Jackson's ObjectMapper on every call.

      Parameters:
      context - provides information to the data converter about the abstraction the data belongs to
      Returns:
      an instance of DataConverter that may use the provided context for serialization
      See Also: