class documentation
class EncodingPayloadConverter(ABC): (source)
Known subclasses: temporalio.contrib.pydantic.PydanticJSONPlainPayloadConverter, temporalio.converter.BinaryNullPayloadConverter, temporalio.converter.BinaryPlainPayloadConverter, temporalio.converter.BinaryProtoPayloadConverter, temporalio.converter.JSONPlainPayloadConverter, temporalio.converter.JSONProtoPayloadConverter
Base converter to/from single payload/value with a known encoding for use in CompositePayloadConverter.
| Method | from |
Decode a single payload to a Python value or raise exception. |
| Method | to |
Encode a single value to a payload or None. |
| Property | encoding |
Encoding for the payload this converter works with. |
@abstractmethod
def from_payload(self, payload:
def from_payload(self, payload:
temporalio.api.common.v1.Payload, type_hint: type | None = None) -> Any:
(source)
¶
overridden in
temporalio.contrib.pydantic.PydanticJSONPlainPayloadConverter, temporalio.converter.BinaryNullPayloadConverter, temporalio.converter.BinaryPlainPayloadConverter, temporalio.converter.BinaryProtoPayloadConverter, temporalio.converter.JSONPlainPayloadConverter, temporalio.converter.JSONProtoPayloadConverterDecode a single payload to a Python value or raise exception.
| Parameters | |
payload:temporalio.api.common.v1.Payload | Payload to convert to Python value. |
typetype | None | Type that is expected if any. This may not have a type if there are no annotations on the target. |
| Returns | |
Any | The decoded value from the payload. Since the encoding is checked by the caller, this should raise an exception if the payload cannot be converted. |
| Raises | |
RuntimeError | General error during decoding. |
@abstractmethod
def to_payload(self, value:
def to_payload(self, value:
Any) -> temporalio.api.common.v1.Payload | None:
(source)
¶
overridden in
temporalio.contrib.pydantic.PydanticJSONPlainPayloadConverter, temporalio.converter.BinaryNullPayloadConverter, temporalio.converter.BinaryPlainPayloadConverter, temporalio.converter.BinaryProtoPayloadConverter, temporalio.converter.JSONPlainPayloadConverter, temporalio.converter.JSONProtoPayloadConverterEncode a single value to a payload or None.
| Parameters | |
value:Any | Value to be converted. |
| Returns | |
temporalio.api.common.v1.Payload | None | Payload of the value or None if unable to convert. |
| Raises | |
TypeError | Value is not the expected type. |
ValueError | Value is of the expected type but otherwise incorrect. |
RuntimeError | General error during encoding. |
overridden in
temporalio.contrib.pydantic.PydanticJSONPlainPayloadConverter, temporalio.converter.BinaryNullPayloadConverter, temporalio.converter.BinaryPlainPayloadConverter, temporalio.converter.BinaryProtoPayloadConverter, temporalio.converter.JSONPlainPayloadConverter, temporalio.converter.JSONProtoPayloadConverterEncoding for the payload this converter works with.