Skip to content

Commit

Permalink
👔 채팅방 리스트 WebClient 호출 로직 추가 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jun108059 committed Aug 16, 2022
1 parent 7eb8c2d commit e05af3f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions socket/src/main/java/hexagonal/socket/service/ChatRoomService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package hexagonal.socket.service;

import hexagonal.socket.dto.RoomInfo;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class ChatRoomService {

private final WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8080")
.build();

public List<RoomInfo> getRoomInfoList() {
return webClient.get()
.uri("/v1/room/list")
.retrieve()
.bodyToFlux(RoomInfo.class)
.toStream()
.collect(Collectors.toList());
}
}

0 comments on commit e05af3f

Please sign in to comment.