Flow에 대해 알아보게된 계기

계기

현재 가구 쇼핑몰을 개발하던 중 RestTemplate가 Deprecate가 되고 WebClient가 대체할 수 있어 WebClient를 사용하는데...

WebClient를 제공하는 라이브러리가 Reactor인 것을 알게됨.

Reactor는 무엇의 구현체인가 알아보니...

Java9의 Flow API.

Flow 소개

Flow 소개

652522B2-355B-47A5-8455-DA7306FD7825.png

미네랄 25 가스 75

Flow 소개

Flow는 자바 9부터 지원 -> 기존의 Observer, Observable 삭제되고, Subscriber<T>, Publisher<T>, Subscription, Processor<T,R> 지원.

This class and the Observer interface have been deprecated. The event model supported by Observer and Observable is quite limited, the order of notifications delivered by Observable is unspecified, and state changes are not in one-for-one correspondence with notifications. For a richer event model, consider using the java.beans package. For reliable and ordered messaging among threads, consider using one of the concurrent data structures in the java.util.concurrent package. For reactive streams style programming, see the java.util.concurrent.Flow API.

옵저버 인터페이스는 더 이상 사용되지않습니다. ... 리액티브 스트림 스타일 프로그래밍은 java.util.concurrent.Flow API를 보세요.

Flow 소개

  1. Flow는 리액티브 프로그래밍을 자바에서 사용하도록 추상화해놓은 API이다.
  2. 스트림 기반의 연산 수행
  3. 이벤트 주도 <---> (리액티브 시스템) 메세지를 주도.