기존의 Feign Client 수정하여 서비스들간의 통신도 주울로 통신하도록 하기

This commit is contained in:
juhyun10
2020-09-05 19:20:40 +09:00
parent d6559f3dea
commit daa1e19bc3
2 changed files with 12 additions and 4 deletions

View File

@@ -5,8 +5,15 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
//@FeignClient(name="member-service",url = "http://localhost:8090/member/")
@FeignClient("${member.service.id}")
//@FeignClient("${service.id.member}")
@FeignClient("${service.id.zuul}") // OK
public interface MemberFeignClient {
@GetMapping(value = "member/name/{nick}")
String URL_PREFIX = "/api/mb/member/"; // 회원 서비스의 주울 라우팅경로와 회원 클래스 주소
/**
* 주울을 통해 호출할 경로 : http://localhost:5555/api/evt/event/member/{nick}
*/
@GetMapping(value = URL_PREFIX + "name/{nick}")
String getYourName(@PathVariable("nick") String nick);
}

View File

@@ -21,11 +21,12 @@ public class EventController {
@GetMapping(value = "name/{nick}")
public String getYourName(@PathVariable("nick") String nick) {
try {
// 히스트릭트 타임아웃을 테스트하기 위함
/*try {
Thread.sleep(4000);
} catch(InterruptedException e) {
e.printStackTrace();;
}
}*/
return "[EVENT] Your name is " + customConfig.getYourName() + ", nickname is " + nick;
}