Class SchemaIdValidationCore
Checks that a record's key and/or value carries a magic byte followed by a schema id (or a guid, in the header or the payload), and that the referenced schema is registered in Schema Registry under the subject the configured strategy derives for the topic.
Stateless: everything that varies per tenant, topic or deployment arrives through
SchemaValidationContext, so a single instance serves all callers. The broker interceptor
holds one context per topic-partition; Kora Edge will hold one per (lkc, topic) while
sharing a single Schema Registry client per LKC.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvalidateRecord(SchemaValidationContext ctx, String topic, org.apache.kafka.common.protocol.ReadableBuf key, org.apache.kafka.common.protocol.ReadableBuf value, org.apache.kafka.common.header.Header[] headers) Validate one record and record the corresponding metrics onctx.
-
Field Details
-
INSTANCE
Shared instance. This class holds no state.
-
-
Method Details
-
validateRecord
public ValidationDecision validateRecord(SchemaValidationContext ctx, String topic, org.apache.kafka.common.protocol.ReadableBuf key, org.apache.kafka.common.protocol.ReadableBuf value, org.apache.kafka.common.header.Header[] headers) Validate one record and record the corresponding metrics onctx.keyandvaluehave their read cursor advanced while parsing the magic byte and schema id, so callers must pass independent views —new ByteBufferAccessor( DefaultRecord.key()), which already duplicates, ornew ReadableByteBuf(buf.slice()). Either may be null, and must be null when the correspondingctx.validateKey()/ctx.validateValue()is false.Both are borrowed, never closed:
ReadableBuf.close()releases the underlying Netty buffer, which the caller still owns.
-