From 19ef90b4c1704f438e0bd19900b23beb7c327e7a Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Tue, 31 Jan 2017 23:44:55 +0100 Subject: [PATCH] First steps with Spring Schema Registry Waiting for Dalston.M1 because of this issue: https://github.com/spring-cloud/spring-cloud-stream/issues/686 --- .../src/main/java/de/example/spring/kafka/Application.java | 2 ++ .../spring-stream-kafka-producer/src/main/resources/application.yml | 3 +++ .../src/main/java/de/example/spring/kafka/Application.java | 2 -- .../spring-stream-kafka-registry/src/main/resources/application.yml | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/java/de/example/spring/kafka/Application.java b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/java/de/example/spring/kafka/Application.java index 1034a98..d513aef 100644 --- a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/java/de/example/spring/kafka/Application.java +++ b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/java/de/example/spring/kafka/Application.java @@ -3,9 +3,11 @@ package de.example.spring.kafka; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.stream.schema.client.EnableSchemaRegistryClient; import org.springframework.context.annotation.Bean; @SpringBootApplication +@EnableSchemaRegistryClient public class Application { public static void main(String[] args) { diff --git a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/resources/application.yml b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/resources/application.yml index c2546c4..a397d64 100644 --- a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/resources/application.yml +++ b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/resources/application.yml @@ -15,6 +15,8 @@ spring: output: binder: kafka destination: test + # Using Apache Avro with Schema Registry + # contentType: application/*+avro contentType: application/json # Consumer (input) and producer (output) are Spring Cloud Stream applications :) headerMode: embeddedHeaders @@ -25,6 +27,7 @@ spring: zkNodes: "kafka:2181" brokers: "kafka:9092,kafka:9093,kafka:9094" autoCreateTopics: true + schemaRegistryClient: "http://localhost:8888/schema-registry/" # Health indicator for binders. management: diff --git a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/java/de/example/spring/kafka/Application.java b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/java/de/example/spring/kafka/Application.java index 9817e62..2bc04e2 100644 --- a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/java/de/example/spring/kafka/Application.java +++ b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/java/de/example/spring/kafka/Application.java @@ -1,9 +1,7 @@ package de.example.spring.kafka; -import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; import org.springframework.cloud.stream.schema.server.EnableSchemaRegistryServer; @SpringBootApplication diff --git a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/resources/application.yml b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/resources/application.yml index bebb6c8..99567c7 100644 --- a/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/resources/application.yml +++ b/SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/resources/application.yml @@ -11,4 +11,4 @@ spring: stream: schema: server: - path: schema + path: schema-registry -- 2.1.4