PayloadCodec
Payload codec.
This allows to transform journal payloads after they're serialized, before they're written to the wire, and before they're deserialized after they're read from the wire. A typical use case is service side journal encryption.
Payloads that are passed through the codec:
- Handlers input and success output
ctx.runsuccess results- Call/send parameters and call success results
- Awakeables, durable promises and signals success results
- State values
Failures (e.g. terminal error messages), state keys, headers and other metadata are not passed through the codec.
The encoding/decoding doesn't need to be deterministic, see isEncodingDeterministic.
The codec can be configured in the endpoint with
Endpoint.Builder#withPayloadCodec(PayloadCodec), and in the ingress client with
Client.connect(String, SerdeFactory, PayloadCodec, RequestOptions).
Implementations of this class MUST be thread safe and asynchronous, as they might block the I/O thread.
NOTE: Using this class in a service requires the native state machine, available on JDK 23+.