Chapter 3. Migrating Apicurio Registry client applications
You must review your existing Apicurio Registry client applications to ensure that the Maven dependencies and Java client configuration meet the new requirements for version 2.x. For example, this includes new Maven dependencies for the Apicurio Registry Java REST client libraries or Kafka client serializer/deserializer (Serdes) libraries. You must also update your Java application configuration with the new registry v2 API path.
Prerequisites
- Existing Apicurio Registry 1.1 Java client application or Kafka client producer and consumer Java applications with SerDes
Procedure
If you are using the Apicurio Registry Java REST client, you must change the Maven dependencies for the Apicurio Registry Java client libraries, which have been repackaged in version 2.x:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-client</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency>
<dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-client</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency>
In your Java client application, you must change your registry URL configuration, from pointing to the existing v1 API path to the new v2 path. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow public class ClientExample { private static final RegistryRestClient client; public static void main(String[] args) throws Exception { // Create a registry client String registryUrl = "https://new-registry.my-company.com/apis/registry/v2"; RegistryClient client = RegistryClientFactory.create(registryUrl); } }
public class ClientExample { private static final RegistryRestClient client; public static void main(String[] args) throws Exception { // Create a registry client String registryUrl = "https://new-registry.my-company.com/apis/registry/v2"; RegistryClient client = RegistryClientFactory.create(registryUrl); } }
You can find more details on the Java client in the Red Hat build of Apicurio Registry User Guide.
If you are using the Apicurio Registry SerDes libraries, you must change the Maven dependencies, which have been repackaged in version 2.x. In Apicurio Registry 1.1, the SerDes libraries were all provided with only one Maven dependency:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-utils-serde</artifactId> <version>1.3.2.Final-redhat-00002</version> </dependency>
<dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-utils-serde</artifactId> <version>1.3.2.Final-redhat-00002</version> </dependency>
In Apicurio Registry 2.x, the SerDes libraries have been split into three Maven dependencies, one for each supported data format:
avro
,protobuf
, andjson schema
, depending on your use cases:Copy to Clipboard Copied! Toggle word wrap Toggle overflow <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-serdes-avro-serde</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency> <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-serdes-protobuf-serde</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency> <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-serdes-jsonschema-serde</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency>
<dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-serdes-avro-serde</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency> <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-serdes-protobuf-serde</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency> <dependency> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-serdes-jsonschema-serde</artifactId> <version>2.4.4.SP1-redhat-00001</version> </dependency>
In your Kafka producer and consumer Java applications, you must change your registry URL configuration from pointing to the existing v1 API path to the new v2 path. For example:
Existing registry v1 API path:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow props.putIfAbsent(AbstractKafkaSerDe.REGISTRY_URL_CONFIG_PARAM, "http://old-registry.my-company.com/api");
props.putIfAbsent(AbstractKafkaSerDe.REGISTRY_URL_CONFIG_PARAM, "http://old-registry.my-company.com/api");
New registry v2 API path:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow props.putIfAbsent(SerdeConfig.REGISTRY_URL, "http://new-registry.my-company.com/apis/registry/v2");
props.putIfAbsent(SerdeConfig.REGISTRY_URL, "http://new-registry.my-company.com/apis/registry/v2");
The refactored SerDes libraries also include other important changes to configuration properties. For more details on SerDes configuration, see the Red Hat build of Apicurio Registry User Guide.
Additional resources
- For detailed configuration examples, see the Apicurio Registry example applications.