본문 바로가기
IT/Spring Boot

Spring Cloud API Gateway

by 골든크랩 2022. 8. 30.
728x90
반응형

안전한 API 유통과 Client 의 요청별로 유연하게 대처 할 수 있으며 API Gateway 는 인증 인가 , L/B & 라우팅 , 로깅 , Circuit Breaker 의 역할을 합니다.

 

Spring Cloud Gateway는 Netty 를 사용한다.

 

Reactive Stream 표준스펙,

반응형 스트림

Rx-Java (Netflix), Project Reactor(Spring)

 

Spring MVC & Spring WebFlux 비교

Spring MVC는 Synchronous / Blocking

Spring WebFlux는 Asynchronous / Non-Blocking

 

https://reactivex.io/

 

ReactiveX

CROSS-PLATFORM Available for idiomatic Java, Scala, C#, C++, Clojure, JavaScript, Python, Groovy, JRuby, and others

reactivex.io

 

https://github.com/ReactiveX/RxJava

 

GitHub - ReactiveX/RxJava: RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based p

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM. - GitHub - ReactiveX/RxJava: RxJava – Reactive E...

github.com

 

위에건 MS에서 만든거고, Spring 진영은 아래 reactor

 

https://projectreactor.io/

 

 

webflux

https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html

 

Web on Reactive Stack

The original web framework included in the Spring Framework, Spring Web MVC, was purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework, Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports

docs.spring.io

스프링 클라우드 필터를 만들때, 위에 것들을 사용해야 한다.

 

API G/W도 Eureka Server에 등록이 필요하므로...Eureka Client가 dependancy가 필요함

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

 

G/W -> Eureka Client 로 바로 가는 방법

 

 

G/W -> Eureka Server -> Eureka Client 로 가는 방법

728x90
반응형

댓글