From c424f15289105a19e9b94377382504bba1dbb047 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 12 Jul 2022 15:27:05 +0600 Subject: [PATCH] fixed json parsing --- .../javadev/kafkaexample/config/KafkaConsumerConfig.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/org/javadev/kafkaexample/config/KafkaConsumerConfig.java b/app/src/main/java/org/javadev/kafkaexample/config/KafkaConsumerConfig.java index 3cb8402..259940f 100644 --- a/app/src/main/java/org/javadev/kafkaexample/config/KafkaConsumerConfig.java +++ b/app/src/main/java/org/javadev/kafkaexample/config/KafkaConsumerConfig.java @@ -11,6 +11,8 @@ import org.springframework.kafka.config.KafkaListenerContainerFactory; import org.springframework.kafka.core.ConsumerFactory; import org.springframework.kafka.core.DefaultKafkaConsumerFactory; import org.springframework.kafka.listener.ConcurrentMessageListenerContainer; +import org.springframework.kafka.support.converter.JsonMessageConverter; +import org.springframework.kafka.support.converter.RecordMessageConverter; import org.springframework.kafka.support.serializer.JsonDeserializer; import java.util.HashMap; @@ -47,4 +49,9 @@ public class KafkaConsumerConfig { return factory; } + @Bean + public RecordMessageConverter converter() { + return new JsonMessageConverter(); + } + } // The End of Class;