Class ProtobufResultWriter
AvroResultWriter on the Avro path.
A message-level CEL rule returns a map of field name to value, which
CelExecutor serializes with Jackson and hands to
ProtobufSchema.fromJson. Two CEL values have no protobuf JSON rendering of their
own: a decimal is a confluent.type.Decimal message, not a number, and a
Variant is a confluent.type.Variant message rather than a POJO Jackson can
reflect over. Left alone the first fails with "Expect message object but got: 13.34" and the
second throws out of Variant.valueBuffer.
A google.protobuf.Timestamp needs the same treatment for the opposite reason: a CEL
timestamp is an Instant, and Jackson renders java.time either not at all or as a numeric
epoch, where protobuf JSON wants an RFC 3339 string.
The walk is driven by the target descriptor rather than by the value's Java type, so a
decimal produced for a plain numeric field still renders as a number — only a field actually
declared as one of these message types is re-shaped. Bytes are emitted as byte[],
which Jackson base64-encodes, and base64 is protobuf JSON's encoding for bytes.
-
Field Details
-
DECIMAL_TYPE_NAME
- See Also:
-
VARIANT_TYPE_NAME
- See Also:
-
TIMESTAMP_TYPE_NAME
- See Also:
-
-
Method Details
-
convert
Convertsresultagainstdescriptor. Anything the descriptor does not describe is returned untouched, so this is safe to call on any CEL result.
-