From: Kai Moritz Date: Thu, 20 Apr 2023 12:22:43 +0000 (+0200) Subject: NEU X-Git-Tag: rebase--2023-08-18~14 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ff5cb6e6847dd8d3caa810d5e4b50160dbe168ac;p=demos%2Fkafka%2Fchat NEU --- diff --git a/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java b/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java index 9692a5bd..e300c0df 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java @@ -34,7 +34,7 @@ class KafkaConfigurationIT extends AbstractConfigurationIT { UUID chatRoomId = UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7"); int shard = shardingStrategy.selectShard(chatRoomId); - chatRoomTemplate.send(TOPIC, null,"{\"id\":\"5c73531c-6fc4-426c-adcb-afc5c140a0f7\",\"shard\":" + shard + ",\"name\":\"FOO\""); + chatRoomTemplate.send(TOPIC, null,"{ \"id\": \"5c73531c-6fc4-426c-adcb-afc5c140a0f7\", \"shard\": " + shard + ", \"name\": \"FOO\" }"); messageTemplate.send(TOPIC,"5c73531c-6fc4-426c-adcb-afc5c140a0f7","{ \"id\" : 1, \"user\" : \"peter\", \"text\" : \"Hallo, ich heiße Peter!\" }"); messageTemplate.send(TOPIC,"5c73531c-6fc4-426c-adcb-afc5c140a0f7","{ \"id\" : 1, \"user\" : \"ute\", \"text\" : \"Ich bin Ute...\" }"); messageTemplate.send(TOPIC,"5c73531c-6fc4-426c-adcb-afc5c140a0f7","{ \"id\" : 2, \"user\" : \"peter\", \"text\" : \"Willst du mit mir gehen?\" }"); diff --git a/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java b/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java index 45769736..63f7dbf4 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java +++ b/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java @@ -2,6 +2,7 @@ package de.juplo.kafka.chat.backend.persistence.kafka; import de.juplo.kafka.chat.backend.ChatBackendProperties; import de.juplo.kafka.chat.backend.domain.ChatHome; +import de.juplo.kafka.chat.backend.domain.Message; import de.juplo.kafka.chat.backend.domain.ShardingStrategy; import de.juplo.kafka.chat.backend.persistence.KafkaLikeShardingStrategy; import org.apache.kafka.clients.consumer.Consumer; @@ -89,6 +90,9 @@ public class KafkaServicesConfiguration JsonSerializer chatRoomSerializer() { JsonSerializer serializer = new JsonSerializer<>(); + serializer.configure( + Map.of(JsonSerializer.ADD_TYPE_INFO_HEADERS, false), + false); return serializer; } @@ -119,6 +123,12 @@ public class KafkaServicesConfiguration JsonDeserializer chatRoomDeserializer() { JsonDeserializer deserializer = new JsonDeserializer<>(); + deserializer.configure( + Map.of( + JsonDeserializer.USE_TYPE_INFO_HEADERS, false, + JsonDeserializer.VALUE_DEFAULT_TYPE, ChatRoomTo.class, + JsonDeserializer.TRUSTED_PACKAGES, getClass().getPackageName()), + false ); return deserializer; } @@ -165,6 +175,9 @@ public class KafkaServicesConfiguration JsonSerializer chatMessageSerializer() { JsonSerializer serializer = new JsonSerializer<>(); + serializer.configure( + Map.of(JsonSerializer.ADD_TYPE_INFO_HEADERS, false), + false); return serializer; } @@ -195,6 +208,12 @@ public class KafkaServicesConfiguration JsonDeserializer chatMessageDeserializer() { JsonDeserializer deserializer = new JsonDeserializer<>(); + deserializer.configure( + Map.of( + JsonDeserializer.USE_TYPE_INFO_HEADERS, false, + JsonDeserializer.VALUE_DEFAULT_TYPE, MessageTo.class, + JsonDeserializer.TRUSTED_PACKAGES, getClass().getPackageName()), + false ); return deserializer; }