Required default constructor for Jackson deserialization.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 29 Jan 2017 18:55:59 +0000 (19:55 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 29 Jan 2017 18:55:59 +0000 (19:55 +0100)
SpringJava/Kafka/SpringCloudStream/spring-cloud-stream-kafka-common-example/src/main/java/de/example/spring/kafka/MyCustomMessageConverter.java
SpringJava/Kafka/SpringCloudStream/spring-cloud-stream-kafka-common-example/src/main/java/de/example/spring/kafka/Product.java
SpringJava/Kafka/SpringCloudStream/spring-cloud-stream-kafka-consumer-example/src/main/resources/application.yml
SpringJava/Kafka/SpringCloudStream/spring-cloud-stream-kafka-producer-example/src/main/resources/application.yml

index 98564a5..6053200 100644 (file)
@@ -4,6 +4,13 @@ public class Product {
        private String name;
        private String description;
        
+       /**
+        * Required for deserialization from Jackson.
+        */
+       protected Product() {
+
+       }
+
        public Product(String name, String description) {
                this.name = name;
                this.description = description;
index 72eafba..f4f8991 100644 (file)
@@ -11,6 +11,8 @@ kafka:
 spring:
   main:
     banner-mode: "off"
+    # We do not need Tomcat running (this application runs from console)
+    web-environment: false
   cloud:
     stream:
       bindings:
@@ -19,6 +21,7 @@ spring:
           destination: test
           group: helloworld
           contentType: application/json
+          startOffset: latest
           consumer:
             concurrency: 1
             partitioned: false
index 07b1ebf..eff109c 100644 (file)
@@ -7,7 +7,7 @@ logging:
 spring:
   main:
     banner-mode: "off"
-    # We do not need Tomcat running (this application runs as a client)
+    # We do not need Tomcat running (this application runs from console)
     web-environment: false
   cloud:
     stream:
@@ -15,10 +15,10 @@ spring:
         output:
           binder: kafka
           destination: test
+          # Requires work around, see: MyCustomMessageConverter
           contentType: application/json
-          # headerMode value is used only when input bindings :(
-          # headerMode: raw
-          #contentType: "application/example"
+          # Consumer (input) and producer (output) are Spring Cloud Stream applications :)
+          headerMode: embeddedHeaders
       instanceCount: 1
       instanceIndex: 0
       kafka: