Skip to content
Confluent Schema registry for Kafka
Branch: master
Clone or download
Latest commit 0f3aebd Apr 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
avro-console-scripts Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
avro-converter remove cp configdefs Apr 8, 2019
avro-serde Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
avro-serializer remove cp configdefs Apr 8, 2019
bin Revert non-core to use Apache as it was changed accidentally Dec 21, 2018
checkstyle CC-3956: Revert "Merge pull request #687 from sunbit-dev/canonical-sc… Feb 28, 2019
client remove cp configdefs Apr 8, 2019
config Revert non-core to use Apache as it was changed accidentally Dec 21, 2018
core Update SchemaRegistryCoordinator to use generated protocol classes (#… Apr 10, 2019
debian Merge branch '5.1.x' Jan 3, 2019
json-serializer remove cp configdefs Apr 8, 2019
licenses Moving licenses and notices to a new format, generated by an internal… Aug 16, 2016
maven-plugin Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
notices Moving licenses and notices to a new format, generated by an internal… Aug 16, 2016
package-kafka-serde-tools Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
package-schema-registry Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
schema-registry-console-scripts
.gitignore Merge remote-tracking branch 'origin/3.0.x' Jul 8, 2016
Jenkinsfile Update Slack Channel subscription on pre-master branches (#802) May 11, 2018
LICENSE Manual updates to use CCL Dec 13, 2018
LICENSE-Apache
LICENSE-ConfluentCommunity
README.md Manual updates to use CCL Dec 13, 2018
generate-licenses-readme.txt Adding a readme to explain how licenses and notices are created. Aug 18, 2016
licenses-and-notices.html Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
pom.xml Bump Confluent to 5.3.0-SNAPSHOT, Kafka to 2.3.0-SNAPSHOT Feb 11, 2019
version.txt CP-140: add version.txt to share/doc (#356) Jun 23, 2016

README.md

Schema Registry

Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas. It stores a versioned history of all schemas, provides multiple compatibility settings and allows evolution of schemas according to the configured compatibility setting. It provides serializers that plug into Kafka clients that handle schema storage and retrieval for Kafka messages that are sent in the Avro format.

Quickstart

The following assumes you have Kafka and an instance of the Schema Registry running using the default settings.

# Register a new version of a schema under the subject "Kafka-key"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
    http://localhost:8081/subjects/Kafka-key/versions
  {"id":1}

# Register a new version of a schema under the subject "Kafka-value"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
     http://localhost:8081/subjects/Kafka-value/versions
  {"id":1}

# List all subjects
$ curl -X GET http://localhost:8081/subjects
  ["Kafka-value","Kafka-key"]

# List all schema versions registered under the subject "Kafka-value"
$ curl -X GET http://localhost:8081/subjects/Kafka-value/versions
  [1]

# Fetch a schema by globally unique id 1
$ curl -X GET http://localhost:8081/schemas/ids/1
  {"schema":"\"string\""}

# Fetch version 1 of the schema registered under subject "Kafka-value"
$ curl -X GET http://localhost:8081/subjects/Kafka-value/versions/1
  {"subject":"Kafka-value","version":1,"id":1,"schema":"\"string\""}

# Fetch the most recently registered schema under subject "Kafka-value"
$ curl -X GET http://localhost:8081/subjects/Kafka-value/versions/latest
  {"subject":"Kafka-value","version":1,"id":1,"schema":"\"string\""}

# Delete version 3 of the schema registered under subject "Kafka-value"
$ curl -X DELETE http://localhost:8081/subjects/Kafka-value/versions/3
  3

# Delete all versions of the schema registered under subject "Kafka-value"
$ curl -X DELETE http://localhost:8081/subjects/Kafka-value
  [1, 2, 3, 4, 5]

# Check whether a schema has been registered under subject "Kafka-key"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
    http://localhost:8081/subjects/Kafka-key
  {"subject":"Kafka-key","version":1,"id":1,"schema":"\"string\""}

# Test compatibility of a schema with the latest schema under subject "Kafka-value"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
    http://localhost:8081/compatibility/subjects/Kafka-value/versions/latest
  {"is_compatible":true}

# Get top level config
$ curl -X GET http://localhost:8081/config
  {"compatibilityLevel":"BACKWARD"}

# Update compatibility requirements globally
$ curl -X PUT -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"compatibility": "NONE"}' \
    http://localhost:8081/config
  {"compatibility":"NONE"}

# Update compatibility requirements under the subject "Kafka-value"
$ curl -X PUT -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"compatibility": "BACKWARD"}' \
    http://localhost:8081/config/Kafka-value
  {"compatibility":"BACKWARD"}

Installation

You can download prebuilt versions of the Kafka REST Proxy as part of the Confluent Platform. To install from source, follow the instructions in the Development section.

Deployment

The REST interface to schema registry includes a built-in Jetty server. The wrapper scripts bin/schema-registry-start and bin/schema-registry-stop are the recommended method of starting and stopping the service.

Development

To build a development version, you may need a development versions of common and rest-utils. After installing these, you can build the Schema Registry with Maven.

This project uses the Google Java code style to keep code clean and consistent.

Contribute

License

The project is licensed under the Confluent Community License, except for client libs, which is under the Apache 2.0 license. See LICENSE file in each subfolder for detailed license agreement.

You can’t perform that action at this time.