From 195130a2ec8694e33da169ff548752dd5d5fa960 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 26 Dec 2022 13:46:53 +0100 Subject: [PATCH] fix: fixed the return-type of the `listen`-endpoint --- .../de/juplo/kafka/chatroom/api/ChatroomController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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)); } } -- 2.20.1