class documentation
class EncodingPayloadConverter(ABC): (source)
Known subclasses: 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: Optional[ Type]
= None) -> Any
:
(source)
¶
overridden in
temporalio.converter.BinaryNullPayloadConverter
, temporalio.converter.BinaryPlainPayloadConverter
, temporalio.converter.BinaryProtoPayloadConverter
, temporalio.converter.JSONPlainPayloadConverter
, temporalio.converter.JSONProtoPayloadConverter
Decode a single payload to a Python value or raise exception.
Parameters | |
payload:temporalio.api.common.v1.Payload | Payload to convert to Python value. |
typeOptional[ | 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
) -> Optional[ temporalio.api.common.v1.Payload]
:
(source)
¶
overridden in
temporalio.converter.BinaryNullPayloadConverter
, temporalio.converter.BinaryPlainPayloadConverter
, temporalio.converter.BinaryProtoPayloadConverter
, temporalio.converter.JSONPlainPayloadConverter
, temporalio.converter.JSONProtoPayloadConverter
Encode a single value to a payload or None.
Parameters | |
value:Any | Value to be converted. |
Returns | |
Optional[ | 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.converter.BinaryNullPayloadConverter
, temporalio.converter.BinaryPlainPayloadConverter
, temporalio.converter.BinaryProtoPayloadConverter
, temporalio.converter.JSONPlainPayloadConverter
, temporalio.converter.JSONProtoPayloadConverter
Encoding for the payload this converter works with.