Apicurio client for Spring Cloud Schema Registry Twitter

Maven Central CircleCI

SonarCloud Bugs Coverage Lines of Code

The aim of this project is to add support for Apicurio Registry in Spring Cloud Schema Registry.
Currently Spring cloud Schema Registry supports Confluent Schema Registry and Spring Schema Registry Server (by default). You may read more about Spring Cloud Schema Registry in their documentation.
Then you can the library with event-driven communication with Spring Cloud Stream and one of the message brokers supported by Spring Cloud Stream, e.g. Kafka or RabbitMQ.

Usage

You just need to include the following dependency to your project.

<dependency>
    <groupId>com.github.piomin</groupId>
    <artifactId>spring-cloud-schema-registry-client-apicurio</artifactId>
    <version>1.2.0</version>
</dependency>

You can also use Jitpack to get the artifact from GitHub Releases directly. Before that add Jitpack to your build file to support loading artifacts directly from GitHub.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Configuration

The default address of schema registry server is http://localhost:8081. You can override it using the following configuration property.

spring.cloud.schemaRegistryClient.endpoint=http://example-apicurioregistry-service:8080/

Concept

You may find an introductory article to Spring Cloud Schema Registry and Spring Cloud Stream with Confluent Registry and Kafka in this article Spring Cloud Stream with Schema Registry and Kafka.

A typical architecture of our solution is visible below. In general, in EDA (event-driven architecture) we may need a tools for messages schema validation and evolving.
Spring Cloud Schema Register implements this approach. The concept is pretty simple. On the producer side client registers a new version of schema (by default in Apache Avro format) using REST API provided by the schema server.
A consumer receives a message with subject name and schema version in the ContentType header. Then it retrieves a schema from schema registry server and deserializes a message. \


Apicurio provides REST API for interaction with registry server. The current version of Apicurio REST API is 2.0.1 is described here.