Class RecordSchemaValidator
java.lang.Object
io.confluent.kafka.schemaregistry.validator.RecordSchemaValidator
- All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.kafka.common.Configurable, org.apache.kafka.server.interceptor.RecordInterceptor
public class RecordSchemaValidator
extends Object
implements org.apache.kafka.server.interceptor.RecordInterceptor
A RecordInterceptor that performs schema validation. This interceptor checks that
1) The record payload has a magic byte, then followed by a schema id integer encoded in the next 4 bytes.
2) The encoded schema id exists in the Schema Registry, and is registered under the subject matching the topic.
If both 1) and 2) are true, then the interceptor will return ACCEPT, otherwise return REJECT.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.kafka.server.interceptor.RecordInterceptor
org.apache.kafka.server.interceptor.RecordInterceptor.RecordInterceptorResponse -
Constructor Summary
ConstructorsConstructorDescriptionRecordSchemaValidator(io.confluent.kafka.schemaregistry.client.SchemaRegistryClient schemaRegistry, org.slf4j.Logger log) -
Method Summary
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.server.interceptor.RecordInterceptor
setMetrics
-
Constructor Details
-
RecordSchemaValidator
public RecordSchemaValidator() -
RecordSchemaValidator
public RecordSchemaValidator(io.confluent.kafka.schemaregistry.client.SchemaRegistryClient schemaRegistry, org.slf4j.Logger log)
-
-
Method Details
-
configure
-
onAppend
public org.apache.kafka.server.interceptor.RecordInterceptor.RecordInterceptorResponse onAppend(org.apache.kafka.common.TopicPartition tp, org.apache.kafka.common.record.internal.Record record) - Specified by:
onAppendin interfaceorg.apache.kafka.server.interceptor.RecordInterceptor
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.apache.kafka.server.interceptor.RecordInterceptor
-