From: Kai Moritz Date: Mon, 26 Dec 2022 12:46:53 +0000 (+0100) Subject: fix: fixed the return-type of the `listen`-endpoint X-Git-Tag: wip~103 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=195130a2ec8694e33da169ff548752dd5d5fa960;p=demos%2Fkafka%2Fchat fix: fixed the return-type of the `listen`-endpoint --- diff --git a/src/main/java/de/juplo/kafka/chatroom/api/ChatroomController.java b/src/main/java/de/juplo/kafka/chatroom/api/ChatroomController.java index 8ea55406..effeccbc 100644 --- a/src/main/java/de/juplo/kafka/chatroom/api/ChatroomController.java +++ b/src/main/java/de/juplo/kafka/chatroom/api/ChatroomController.java @@ -1,7 +1,6 @@ package de.juplo.kafka.chatroom.api; import de.juplo.kafka.chatroom.domain.Chatroom; -import de.juplo.kafka.chatroom.domain.Message; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; @@ -67,8 +66,11 @@ public class ChatroomController @GetMapping( path = "listen/{chatroomId}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) - public Flux listen(@PathVariable UUID chatroomId) + public Flux listen(@PathVariable UUID chatroomId) { - return chatrooms.get(chatroomId).listen(); + return chatrooms + .get(chatroomId) + .listen() + .map(message -> MessageTo.from(message)); } }