From: Kai Moritz Date: Wed, 25 Jan 2023 16:49:28 +0000 (+0100) Subject: WIP:refactor X-Git-Tag: wip~16 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9e3d108a0e76ba4f958b1db84f2fbf31476ed019;p=demos%2Fkafka%2Fchat WIP:refactor --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java index a42434b8..9ae967bd 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java @@ -69,9 +69,7 @@ public class ChatRoom .getMessage(key) .flatMap(existing -> text.equals(existing.getMessageText()) ? Mono.just(existing) - : Mono.error(() -> new MessageMutationException(existing, text))) - .onErrorReturn( - service + : service .persistMessage(key, LocalDateTime.now(clock), text) .doOnNext(m -> { @@ -80,7 +78,7 @@ public class ChatRoom { log.warn("Emitting of message failed with {} for {}", result.name(), m); } - }).block()); + })); }