import de.juplo.kafka.chat.backend.domain.ChatHome;
import de.juplo.kafka.chat.backend.domain.Chatroom;
+import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.time.Clock;
import java.time.LocalDateTime;
-import java.util.Collection;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Stream;
{
private final ChatHome chatHome;
private final Clock clock;
+ private final StorageStrategy storageStrategy;
@PostMapping("create")
.log()
.map(message -> MessageTo.from(message));
}
+
+ @PostMapping("/store")
+ public void store()
+ {
+ storageStrategy.writeChatrooms(Flux.fromStream(chatHome.list()));
+ }
}