This schema registry stores schemas in a Git repository. It consists of these components:
-
A Maven plugin puts schemas into the schema registry.
-
A server provides schemas from the schema registry. It exposes an API compatible with the Confluent schema registry.
This Maven plugin puts a schema into the schema registry. If a new schema is incompatible with registered schemas, then the plugin fails the Maven build.
<plugin>
<groupId>com.github.pukkaone.accession</groupId>
<artifactId>schema-registry-maven-plugin</artifactId>
<version>${accession.version}</version>
<configuration>
<compatibility>FORWARD</compatibility>
<registryRepositories>
<registryRepository>
<projectBranchPattern>main</projectBranchPattern>
<registryUri>ssh://[email protected]/example/schema-registry.git</registryUri>
<registryBranch>main</registryBranch>
<mutableVersions>false</mutableVersions>
</registryRepository>
<registryRepository>
<projectBranchPattern>.*</projectBranchPattern>
<registryUri>ssh://[email protected]/example/schema-registry.git</registryUri>
<registryBranch>develop</registryBranch>
<mutableVersions>true</mutableVersions>
</registryRepository>
</registryRepositories>
<registrations>
<registration>
<subject>topic</subject>
<version>1</version>
<reflectClass>com.example.Event</reflectClass>
</registration>
</registrations>
</configuration>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>register</goal>
</goals>
</execution>
</executions>
</plugin>
Parameter | Description |
---|---|
|
How to compare new schema to registered schema for compatibility. Allowed values are BACKWARD, FORWARD, FULL. Default is FORWARD. |
|
Rules to select which Git repository and branch will
store the schemas. Only the first matching rule applies. A rule matches if
the |
|
Regular expression to match project checked-out Git branch. |
|
Schema registry Git repository URI |
|
Schema registry Git branch |
|
Whether to allow changing the schema of an existing version |
|
Requests to register a schema in a subject and version |
|
Scope in which schemas can evolve. If the subject does not end with
|
|
integer (0 to 999) uniquely identifying the version within the subject |
|
Java class to introspect to generate Avro schema |
The above example shows the intent to forbid changing schemas registered in
the main
branch of the Git repository, by setting the mutableVersions
parameter to false. If the version
parameter specifies a version already
existing in the schema registry, then the plugin verifies the schema to be
registered is identical to the schema in the existing version. An attempt to
register a different schema in an existing version causes the plugin to fail
the Maven build.
To allow work in progress schema changes to a version, the mutableVersions
parameter is true for the develop
branch of the Git repository. If the
version
parameter specifies a version already existing in the schema
registry, then the plugin replaces the schema in that version.