spring-kafka

Spring boot Rest api with Spring Kafka

最后都变了- 提交于 2020-08-19 09:01:27
问题 I have designed a Spring boot REST API ADD and GET method @RestController("ProductV1Controller") public class ProductController { private final IProductProducer _productProducer; public ProductController(IProductProducer productProducer) { _productProducer = productProducer;} @PostMapping() void AddProduct(@Valid @RequestBody ProductViewModel product) { _productProducer.AddProduct(product); } @GetMapping() List<ProductViewModel> Products() { var test = _productProducer.GetProducts(); return

How to include Type MetaData for Deserialization in Spring Kafka

爱⌒轻易说出口 提交于 2020-08-10 19:13:28
问题 I am doing deserialization at the Listener in Spring Kafka. But this assumes that the type information was included or sent by a Spring Kafka producer. In my case the Json is being sent across by the Debezium MySQLConnector and it does not add this meta data. So I would like to add it to the requests. I understand its placed in the request somewhere in the JsonSerializer, and I looked at the source code but could not figure out exactly how to use this to add meta data type during

Spring Batch - Kafka: KafkaItemReader reads the data ALWAYS from beginning

最后都变了- 提交于 2020-08-10 06:12:19
问题 I'm willing to use Spring Batch for Kafka data consumption. This spring-tips link has a basic example for the same. Here's my reader : @Bean KafkaItemReader<String, String> kafkaItemReader() { var props = new Properties(); props.putAll(this.properties.buildConsumerProperties()); return new KafkaItemReaderBuilder<String, String>() .partitions(0) .consumerProperties(props) .name("customers-reader") .saveState(true) .topic("test-consumer") .build(); } My application.properties file: spring:

Kafka Spring Deserialzer returnType static method never called

蓝咒 提交于 2020-08-09 14:58:27
问题 Here is the error I get: org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition distance-0 at offset 0. If needed, please seek past the record to continue consumption. Caused by: java.lang.IllegalStateException: No type information in headers and no default type provided at org.springframework.util.Assert.state(Assert.java:73) at org. springframework.kafka.support.serializer.JsonDeserializer.deserialize(JsonDeserializer.java:370) And applicaiton-dev

Kafka Spring Deserialzer returnType static method never called

折月煮酒 提交于 2020-08-09 14:56:36
问题 Here is the error I get: org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition distance-0 at offset 0. If needed, please seek past the record to continue consumption. Caused by: java.lang.IllegalStateException: No type information in headers and no default type provided at org.springframework.util.Assert.state(Assert.java:73) at org. springframework.kafka.support.serializer.JsonDeserializer.deserialize(JsonDeserializer.java:370) And applicaiton-dev

Kafka Spring Deserialzer returnType static method never called

北城余情 提交于 2020-08-09 14:56:25
问题 Here is the error I get: org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition distance-0 at offset 0. If needed, please seek past the record to continue consumption. Caused by: java.lang.IllegalStateException: No type information in headers and no default type provided at org.springframework.util.Assert.state(Assert.java:73) at org. springframework.kafka.support.serializer.JsonDeserializer.deserialize(JsonDeserializer.java:370) And applicaiton-dev

How to I programaticaly set JsonDeserializer TypeValue method in Spring Kafka

五迷三道 提交于 2020-08-07 09:55:12
问题 So I have not been able to configure the JavaType method for JsonSerializer using only yaml. Not sure the reason yet, but in the meantime how do I set this programatically? I have seen code for it in the documentation but where exactly does this code need to run? Spring Kafka: JsonDeserializer doesn't pick up TRUSTED_PACKAGE config This is what I tried so far. Kafka Spring Deserialzer returnType static method never called PS I am on Spring Boot 2.1.8 so cannot easily use the newer way with

How to I programaticaly set JsonDeserializer TypeValue method in Spring Kafka

荒凉一梦 提交于 2020-08-07 09:52:29
问题 So I have not been able to configure the JavaType method for JsonSerializer using only yaml. Not sure the reason yet, but in the meantime how do I set this programatically? I have seen code for it in the documentation but where exactly does this code need to run? Spring Kafka: JsonDeserializer doesn't pick up TRUSTED_PACKAGE config This is what I tried so far. Kafka Spring Deserialzer returnType static method never called PS I am on Spring Boot 2.1.8 so cannot easily use the newer way with