티스토리 뷰
Tech.io의 'Reactive Programming with Reactor 3'을 공부하면서 정리하는 글입니다.
Mono
- 리액티브 스트림의
Publisher
구현체 - 단 하나의 요소만 내놓는다(=Emit)
- Mono 가 가능한 상태
- 하나의 값을 가지고 있는 상태 (complete with element)
- 빈 상태 (complete without element)
- 실패한 상태 (error)
Mono<Void>
타입은 완료 신호에만 관심이 있는 경우 사용- 연산자를 이용하여 '비동기 파이프라인'을 구성 가능 (
Publisher
를 상속한Reactor
의 특징)
마블 다이어그램
Mono 의 일반적인 마블 다이어그램
실제 예제 코드
Mono.just(1)
.map(integer -> "foo" + integer)
.or(Mono.delay(Duration.ofMillis(100)))
.subscribe(System.out::println);
연습
// TODO Return an empty Mono
Mono<String> emptyMono() {
return Mono.empty();
}
// TODO Return a Mono that never emits any signal
Mono<String> monoWithNoSignal() {
return Mono.never();
}
// TODO Return a Mono that contains a "foo" value
Mono<String> fooMono() {
return Mono.just("foo");
}
// TODO Create a Mono that emits an IllegalStateException
Mono<String> errorMono() {
return Mono.error(new IllegalStateException());
}
관련글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- intellij
- console
- reactiveprogramming
- 자바스크립트
- 리액터
- 윈도우즈
- tipoftheday
- Git
- Widget
- JavaScript
- Coffeescript
- dojo
- Configuration
- React
- Windows
- Commonjs
- Java
- unit test
- VI
- 빔
- 자바
- Node.js
- Eclipse
- REACTOR
- maven
- 스프링인액션
- 리액티브프로그래밍
- 커피스크립트
- VIM
- gvim
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함