From: Kai Moritz Date: Wed, 25 Jan 2023 16:45:59 +0000 (+0100) Subject: WIP:refactor X-Git-Tag: wip~17 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=f36c65e847a54eda6f0701182a54b64361ab8508;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 f5e3b06b..a42434b8 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 @@ -70,7 +70,7 @@ public class ChatRoom .flatMap(existing -> text.equals(existing.getMessageText()) ? Mono.just(existing) : Mono.error(() -> new MessageMutationException(existing, text))) - .switchIfEmpty( + .onErrorReturn( service .persistMessage(key, LocalDateTime.now(clock), text) .doOnNext(m -> @@ -80,7 +80,7 @@ public class ChatRoom { log.warn("Emitting of message failed with {} for {}", result.name(), m); } - })); + }).block()); }