From 564d327a20c044198f5ae52c1bcf3fe5cdfbdb02 Mon Sep 17 00:00:00 2001 From: pablo gonzalez granados Date: Thu, 2 Sep 2021 13:12:41 +0200 Subject: [PATCH] Move on to new Quarkus apicurio registry library --- .../kafka-avro-reactive-messaging/pom.xml | 22 ++++++------------- .../src/main/resources/application.properties | 14 ++++++------ .../resources/docker-compose-strimzi.yaml | 2 +- .../kafka/OpenShiftAmqStreamsKafkaAvroIT.java | 3 ++- .../messaging/kafka/StrimziKafkaAvroIT.java | 2 +- .../resources/strimzi-application.properties | 20 +++++++++-------- pom.xml | 18 --------------- 7 files changed, 29 insertions(+), 52 deletions(-) diff --git a/messaging/kafka-avro-reactive-messaging/pom.xml b/messaging/kafka-avro-reactive-messaging/pom.xml index bb479227b..bd33ecbc2 100644 --- a/messaging/kafka-avro-reactive-messaging/pom.xml +++ b/messaging/kafka-avro-reactive-messaging/pom.xml @@ -18,10 +18,17 @@ io.quarkus quarkus-resteasy-jsonb + + io.quarkus + quarkus-apicurio-registry-avro + + + io.quarkus quarkus-avro + io.confluent kafka-avro-serializer @@ -30,21 +37,6 @@ io.quarkus quarkus-scheduler - - io.apicurio - apicurio-registry-utils-serde - - - org.jboss.spec.javax.interceptor - jboss-interceptors-api_1.2_spec - - - - - - io.quarkiverse.apicurio - quarkiverse-apicurio-registry-client - org.jboss.resteasy resteasy-client diff --git a/messaging/kafka-avro-reactive-messaging/src/main/resources/application.properties b/messaging/kafka-avro-reactive-messaging/src/main/resources/application.properties index a5f1ee394..b268e0e11 100644 --- a/messaging/kafka-avro-reactive-messaging/src/main/resources/application.properties +++ b/messaging/kafka-avro-reactive-messaging/src/main/resources/application.properties @@ -2,17 +2,17 @@ %dev.kafka.bootstrap.servers=localhost:9092 #TODO: Disable health check because of https://github.com/quarkusio/quarkus/issues/15464 %dev.quarkus.reactive-messaging.health.enabled=false -%dev.mp.messaging.connector.smallrye-kafka.apicurio.registry.url=http://localhost:8081/api +%dev.mp.messaging.connector.smallrye-kafka.apicurio.registry.url=http://localhost:8081/apis/registry/v2 %dev.mp.messaging.outgoing.source-stock-price.connector=smallrye-kafka %dev.mp.messaging.outgoing.source-stock-price.topic=stock-price -%dev.mp.messaging.outgoing.source-stock-price.value.serializer=io.apicurio.registry.utils.serde.AvroKafkaSerializer -%dev.mp.messaging.outgoing.source-stock-price.apicurio.registry.artifact-id=io.apicurio.registry.utils.serde.strategy.SimpleTopicIdStrategy -%dev.mp.messaging.outgoing.source-stock-price.apicurio.registry.global-id=io.apicurio.registry.utils.serde.strategy.GetOrCreateIdStrategy -%dev.mp.messaging.outgoing.source-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.utils.serde.avro.ReflectAvroDatumProvider +%dev.mp.messaging.outgoing.source-stock-price.value.serializer=io.apicurio.registry.serde.avro.AvroKafkaSerializer +%dev.mp.messaging.outgoing.source-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.serde.avro.ReflectAvroDatumProvider +%dev.mp.messaging.outgoing.source-stock-price.apicurio.registry.auto-register=true + %dev.mp.messaging.incoming.channel-stock-price.connector=smallrye-kafka %dev.mp.messaging.incoming.channel-stock-price.topic=stock-price %dev.mp.messaging.incoming.channel-stock-price.specific.avro.reader=true -%dev.mp.messaging.incoming.channel-stock-price.value.deserializer=io.apicurio.registry.utils.serde.AvroKafkaDeserializer +%dev.mp.messaging.incoming.channel-stock-price.value.deserializer=io.apicurio.registry.serde.avro.AvroKafkaDeserializer %dev.mp.messaging.incoming.channel-stock-price.auto.offset.reset=earliest %dev.mp.messaging.incoming.channel-stock-price.enable.auto.commit=true -%dev.mp.messaging.incoming.channel-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.utils.serde.avro.ReflectAvroDatumProvider +%dev.mp.messaging.incoming.channel-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.serde.avro.ReflectAvroDatumProvider diff --git a/messaging/kafka-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml b/messaging/kafka-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml index 9040a5ad1..d7a3e3044 100644 --- a/messaging/kafka-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml +++ b/messaging/kafka-avro-reactive-messaging/src/main/resources/docker-compose-strimzi.yaml @@ -32,7 +32,7 @@ services: KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 schema-registry: - image: apicurio/apicurio-registry-mem:1.3.1.Final + image: apicurio/apicurio-registry-mem:2.0.1.Final ports: - 8081:8080 depends_on: diff --git a/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/OpenShiftAmqStreamsKafkaAvroIT.java b/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/OpenShiftAmqStreamsKafkaAvroIT.java index 678bee21f..1c5ecc0eb 100644 --- a/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/OpenShiftAmqStreamsKafkaAvroIT.java +++ b/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/OpenShiftAmqStreamsKafkaAvroIT.java @@ -13,11 +13,12 @@ @EnabledIfSystemProperty(named = "ts.redhat.registry.enabled", matches = "true") public class OpenShiftAmqStreamsKafkaAvroIT extends BaseKafkaAvroIT { - @KafkaContainer(vendor = KafkaVendor.STRIMZI, image = "${amq-streams.image}", version = "${amq-streams.version}", withRegistry = true) + @KafkaContainer(vendor = KafkaVendor.STRIMZI, image = "${amq-streams.image}", version = "${amq-streams.version}", withRegistry = true, registryPath = "/apis/registry/v2") static KafkaService kafka = new KafkaService(); @QuarkusApplication static RestService app = new RestService() + .withProperties("strimzi-application.properties") .withProperty("kafka.bootstrap.servers", kafka::getBootstrapUrl) .withProperty("kafka.registry.url", kafka::getRegistryUrl); diff --git a/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/StrimziKafkaAvroIT.java b/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/StrimziKafkaAvroIT.java index 3a68dd025..685fd3bf0 100644 --- a/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/StrimziKafkaAvroIT.java +++ b/messaging/kafka-avro-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/StrimziKafkaAvroIT.java @@ -10,7 +10,7 @@ @QuarkusScenario public class StrimziKafkaAvroIT extends BaseKafkaAvroIT { - @KafkaContainer(vendor = KafkaVendor.STRIMZI, withRegistry = true) + @KafkaContainer(vendor = KafkaVendor.STRIMZI, withRegistry = true, registryPath = "/apis/registry/v2") static KafkaService kafka = new KafkaService(); @QuarkusApplication diff --git a/messaging/kafka-avro-reactive-messaging/src/test/resources/strimzi-application.properties b/messaging/kafka-avro-reactive-messaging/src/test/resources/strimzi-application.properties index f63691e43..f72a030f1 100644 --- a/messaging/kafka-avro-reactive-messaging/src/test/resources/strimzi-application.properties +++ b/messaging/kafka-avro-reactive-messaging/src/test/resources/strimzi-application.properties @@ -1,19 +1,21 @@ # Configuration file - Quarkus profile: Strimzi kafka.bootstrap.servers=kafka-broker-1:9092 +mp.messaging.outgoing.source-stock-price.connector=smallrye-kafka # TODO: Disable health check because of https://github.com/quarkusio/quarkus/issues/15464 quarkus.reactive-messaging.health.enabled=false + mp.messaging.connector.smallrye-kafka.apicurio.registry.url=${kafka.registry.url} -mp.messaging.outgoing.source-stock-price.connector=smallrye-kafka + +mp.messaging.outgoing.source-stock-price.value.serializer=io.apicurio.registry.serde.avro.AvroKafkaSerializer +mp.messaging.outgoing.source-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.serde.avro.ReflectAvroDatumProvider +mp.messaging.outgoing.source-stock-price.apicurio.registry.auto-register=true mp.messaging.outgoing.source-stock-price.topic=stock-price -mp.messaging.outgoing.source-stock-price.value.serializer=io.apicurio.registry.utils.serde.AvroKafkaSerializer -mp.messaging.outgoing.source-stock-price.apicurio.registry.artifact-id=io.apicurio.registry.utils.serde.strategy.SimpleTopicIdStrategy -mp.messaging.outgoing.source-stock-price.apicurio.registry.global-id=io.apicurio.registry.utils.serde.strategy.GetOrCreateIdStrategy -mp.messaging.outgoing.source-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.utils.serde.avro.ReflectAvroDatumProvider + mp.messaging.incoming.channel-stock-price.connector=smallrye-kafka mp.messaging.incoming.channel-stock-price.topic=stock-price -mp.messaging.incoming.channel-stock-price.specific.avro.reader=true -mp.messaging.incoming.channel-stock-price.value.deserializer=io.apicurio.registry.utils.serde.AvroKafkaDeserializer mp.messaging.incoming.channel-stock-price.auto.offset.reset=earliest mp.messaging.incoming.channel-stock-price.enable.auto.commit=true -mp.messaging.incoming.channel-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.utils.serde.avro.ReflectAvroDatumProvider -quarkus.openshift.expose=true +mp.messaging.incoming.channel-stock-price.value.deserializer=io.apicurio.registry.serde.avro.AvroKafkaDeserializer +mp.messaging.incoming.channel-stock-price.apicurio.registry.avro-datum-provider=io.apicurio.registry.serde.avro.ReflectAvroDatumProvider + +quarkus.openshift.expose=true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6083d5997..eecf2ebbd 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,6 @@ 0.27.0 2.2.2.Final 4.5.13 - 1.3.2.Final - 0.0.2 6.2.0 2.16.0 1.6.2 @@ -48,12 +46,6 @@ - - - com.squareup.retrofit2 - retrofit - 2.9.0 - ${quarkus.platform.group-id} ${quarkus.platform.artifact-id} @@ -75,16 +67,6 @@ pom import - - io.apicurio - apicurio-registry-utils-serde - ${apicurio.registry.utils.serde.version} - - - io.quarkiverse.apicurio - quarkiverse-apicurio-registry-client - ${quarkiverse.apicurio.registry.client.version} - io.confluent kafka-avro-serializer