Quantcast
Channel: Active questions tagged consumer - Stack Overflow
Viewing all articles
Browse latest Browse all 91

Why can't I do consumer setValueDeserializer on spring kafka using kotlin

$
0
0

When trying to implement DefaultKafkaConsumerFactoryCustomizer in kotlin Spring Kafka, the parameter in the setValueDeserializer method is nothing and cannot be customized.enter image description here

method in DefaultKafkaConsumerFactoryenter image description here

id 'org.springframework.boot' version '3.1.4'id 'io.spring.dependency-management' version '1.1.3'id 'org.jetbrains.kotlin.jvm' version '1.8.22'id 'org.jetbrains.kotlin.plugin.spring' version '1.8.22'

So I can't override it, so I defined it in properties.

spring.kafka.bootstrap-servers=localhost:9092spring.kafka.consumer.properties.spring.json.type.mapping=CREATE:com.example.demo.BundleView$CreateBundleViewImplspring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.ErrorHandlingDeserializerspring.kafka.consumer.properties.spring.deserializer.value.delegate.class=org.springframework.kafka.support.serializer.JsonDeserializerspring.jackson.property-naming-strategy=SNAKE_CASE

but kafka message

However, when kafka message enters the snake case, SerializationException: Can't deserialize data error occurs.It works normally if it is used as a camel case.


Viewing all articles
Browse latest Browse all 91

Trending Articles