From c4fd031abdae00bdbd934216579f0a38ddd46783 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 17 Apr 2022 13:44:49 +0200 Subject: [PATCH] =?utf8?q?Springify:=20Nachrichten-Typ=20wird=20=C3=BCber?= =?utf8?q?=20den=20Type-Info-Header=20bestimmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/de/juplo/kafka/ApplicationConfiguration.java | 2 +- src/test/java/de/juplo/kafka/ApplicationTests.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 566c7a3..431041c 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -62,7 +62,7 @@ public class ApplicationConfiguration props.put("metadata.max.age.ms", "1000"); props.put("key.deserializer", StringDeserializer.class.getName()); props.put("value.deserializer", JsonDeserializer.class.getName()); - props.put(JsonDeserializer.VALUE_DEFAULT_TYPE, ClientMessage.class.getName()); + props.put(JsonDeserializer.TYPE_MAPPINGS, "message:" + ClientMessage.class.getName()); props.put(JsonDeserializer.TRUSTED_PACKAGES, "de.juplo.kafka"); return new KafkaConsumer<>(props); diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index fbc668f..6c25bcd 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -203,6 +203,7 @@ class ApplicationTests Integer.toString(key%2), value); + record.headers().add("__TypeId__", "message".getBytes()); kafkaProducer.send(record, (metadata, e) -> { if (metadata != null) -- 2.20.1