From c27ef103242f53d90eb9e522fe65a3dad4d17cea Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 4 Sep 2022 08:00:08 +0200 Subject: [PATCH] Vorlage --- .../java/de/juplo/kafka/ApplicationConfiguration.java | 6 +----- .../java/de/juplo/kafka/ApplicationRecordHandler.java | 11 +---------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 93db3b5..101bd13 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -89,11 +89,7 @@ public class ApplicationConfiguration props.put("auto.commit.interval.ms", (int)properties.getCommitInterval().toMillis()); props.put("metadata.max.age.ms", "1000"); props.put("key.deserializer", StringDeserializer.class.getName()); - props.put("value.deserializer", JsonDeserializer.class.getName()); - props.put(JsonDeserializer.TRUSTED_PACKAGES, "de.juplo.kafka"); - props.put(JsonDeserializer.TYPE_MAPPINGS, - Message.Type.ADD + ":" + MessageAddNumber.class.getName() + "," + - Message.Type.CALC + ":" + MessageCalculateSum.class.getName()); + props.put("value.deserializer", "TODO: JsonDeserializer konfigurieren"); return new KafkaConsumer<>(props); } diff --git a/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java b/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java index 2829157..559bd90 100644 --- a/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java +++ b/src/main/java/de/juplo/kafka/ApplicationRecordHandler.java @@ -46,16 +46,7 @@ public class ApplicationRecordHandler implements RecordHandler String user = record.key(); Message message = record.value(); - switch(message.getType()) - { - case ADD: - addNumber(partition, user, (MessageAddNumber) message); - break; - - case CALC: - calculateSum(partition, user, (MessageCalculateSum) message); - break; - } + // TODO: JSON-Nachrichten verarbeiten if (throttle.isPresent()) { -- 2.20.1