Spring Webflux
Opened this issue · 6 comments
gringrape commented
- Hello World
- 하나의 자원과 여러개의 자원을 반환하는 예시 - https://www.baeldung.com/spring-webflux
- message -> thread 생성 후 종합
gringrape commented
프로젝트 설정: https://start.spring.io/
gringrape commented
Unzip to particular destination
unzip -d ./ ~/Downloads/greeting.zip
j option
-j junk paths. The archive's directory structure is not recreated;
all files are deposited in the extraction directory (by default,
the current one).
가장 상위 경로 정보 제거
unzip -j -d ./ ~/Downloads/greeting.zip
위와 같이 junk path
옵션을 사용 하면 파일의 상대 경로 정보가 모두 소실된다.
다음처럼 목적지 설정후에 이름을 바꿔준다.
unzip -d ./ ~/Downloads/greeting.zip && mv greeting spring-webflux-example
gringrape commented
gringrape commented
Mono
하나의 자원에 대한 지연된 자원 개념.
Promise 와 유사함.
Mono create
Mono.<String>create(sink -> {
HttpListener listener = event -> {
if (event.getResponseCode() >= 400) {
sink.error(new RuntimeException("Failed"));
} else {
String body = event.getBody();
if (body.isEmpty()) {
sink.success();
} else {
sink.success(body.toLowerCase());
}
}
};
client.addListener(listener);
sink.onDispose(() -> client.removeListener(listener));
});
gringrape commented
Flux, Mono operator 를 조작하는 방법.
https://projectreactor.io/docs/core/release/reference/index.html#which-operator