반응형
제육's 휘발성 코딩
반응형
[MSA] Spring Cloud Gateway Filter 적용
🔷 Spring/MSA 2022. 11. 5. 19:14

Spring Cloud Gateway Filter 적용 Spring Cloud Gateway는 다음과 같이 마이크로서비스들과 클라이언트단의 라우팅 역할을 해준다. 이때 Filter 기능을 통해 조건을 분기한다. 사전에 정의하는 PreFilter 와 사후에 정의하는 PostFilter가 있다. Filter 정의는 Java 코드 상에서 사용하거나, Property에 정의할 수 있다. 동작 과정 동작 흐름은 다음과 같이 이루어진다. 최초의 Request시에 Request-Header에 서비스명을 넣어 로직을 처리해주고, 마지막 Response 시에도 마찬가지로 Response-Header에 서비스명을 넣어 요청에 맞는 클라이언트에게 반환주는 방식이다. 공식문서에는 다음과 같이 정의되어 있다. 필터를 통해 Pr..

[MSA] Spring Cloud - Zuul vs API Gateway
🔷 Spring/MSA 2022. 10. 30. 19:55

API Gateway란 API Gateway란 여러 마이크로 서비스들과 통신하기 위한 단일 지점(진입로)으로 모든 요청에 대해서 일괄적으로 처리해준다. Gateway는 인증 및 권한 체크, 응답 캐싱, 부하 분산 등의 역할을 수행한다. Spring Cloud 에서 MSA 간 통신 RestTemplate RestTemplate restTemplate = new RestTemplate(); restTemplate.getForObejct("url", Domain.class, 200); RestTemplate 을 통해 MSA url을 기반으로 통신하는 방법이다. Feign Client @FeignClient("test") public interface TestClient { @RequestMapping(meth..

[MSA] Spring Cloud - Eureka Service Discovery 설정하기
🔷 Spring/MSA 2022. 10. 25. 22:22

Eureka Server 생성 Discovery Service 역할을 하는 서버 프로젝트를 생성하자. IntelliJ에서 Spring Initializr를 사용하여 프로젝트를 생성하자. Spring Cloud와 Spring Boot 버전이 서로 다르면 오류가 발생하므로 버전 확인을 하자. Eureka Server 라이브러리를 의존성으로 주입해주자. pom.xml 4.0.0 org.springframework.boot spring-boot-starter-parent 2.7.5 com.example discoveryservice 0.0.1-SNAPSHOT discoveryservice discoveryservice 1.8 2021.0.4 org.springframework.cloud spring-cloud-..

[MSA] Spring Cloud란? 등장 배경 및 구성도
🔷 Spring/MSA 2022. 10. 24. 02:10

Spring Cloud 란? https://spring.io/projects/spring-cloud Spring Cloud Spring Cloud is an umbrella project consisting of independent projects with, in principle, different release cadences. To manage the portfolio a BOM (Bill of Materials) is published with a curated set of dependencies on the individual project. Go here to r spring.io 스프링 클라우드란 프록시, 서비스 검색, 서비스간 호출 등 여러 공통 패턴을 분산 시스템에서 동작할 수 있도록 ..

반응형
반응형