Zulu는 Edge 서비스 또는 GateWay서비스라고 불리며 이것이 필요한 이유는 간단하다.
마이크로 서비스는 수많은 여러개의 아이피와 포트로 분산되어 구동이 되고 있으며
로드 밸러스를 고려하여 엔드포인트 기반으로 하나의 단일 도메인 단일 포트로 접근할수 있는 장치가 있어야한다.
개요
EdgeService 는 단독으로도 작동이 되지만, Eureka와 Cloud Config와 완벽하게 연동이되니
앞장에서 설명한 두가지를 먼저 구동시키는것을 권장합니다.
셋팅
git : https://github.com/psmon/springcloud/tree/master/edge-service
config : https://github.com/psmon/springcloud/blob/master/library/config-sample/edgeservice.yml
서버
@EnableZuulProxy @EnableDiscoveryClient @SpringBootApplication @EnableSwagger2 public class EdgeServiceApplication { public static void main(String[] args) { SpringApplication.run(EdgeServiceApplication.class, args); } } <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-zuul</artifactId> </dependency>
Config
spring: profiles: local server: port: 8765 zuul: prefix: /api routes: account: path: /account/** serviceId: accountapi lobby: path: /lobby/** serviceId: lobbyapi game: path: /game/** serviceId: gameapi ribbon: eureka: enabled: true message: "hello, spring cloud edgeservice -local"