Class SchemaIdValidationCore

java.lang.Object
io.confluent.kafka.schemaregistry.validator.core.SchemaIdValidationCore

public final class SchemaIdValidationCore extends Object
Schema ID validation, shared by every caller that needs it.

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 Details

  • 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 on ctx.

      key and value have 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, or new ReadableByteBuf(buf.slice()). Either may be null, and must be null when the corresponding ctx.validateKey()/ctx.validateValue() is false.

      Both are borrowed, never closed: ReadableBuf.close() releases the underlying Netty buffer, which the caller still owns.