First steps with Spring Schema Registry
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 31 Jan 2017 22:44:55 +0000 (23:44 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 31 Jan 2017 22:44:55 +0000 (23:44 +0100)
Waiting for Dalston.M1 because of this issue: https://github.com/spring-cloud/spring-cloud-stream/issues/686

SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/java/de/example/spring/kafka/Application.java
SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-producer/src/main/resources/application.yml
SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/java/de/example/spring/kafka/Application.java
SpringJava/Kafka/SpringCloudStream/spring-stream-kafka-registry/src/main/resources/application.yml

index 1034a98..d513aef 100644 (file)
@@ -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) {
index c2546c4..a397d64 100644 (file)
@@ -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:
index 9817e62..2bc04e2 100644 (file)
@@ -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