From: Kai Moritz Date: Sun, 4 Sep 2022 06:00:08 +0000 (+0200) Subject: Vorlage X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=a927b93e0fe43dd700fe5c121ed79fec4a8867db;p=demos%2Fkafka%2Ftraining Vorlage --- diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 596be26..a769779 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -92,11 +92,7 @@ public class ApplicationConfiguration props.put("auto.offset.reset", properties.getAutoOffsetReset()); 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()) {