반응형
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- cassandra
- vue.js
- KAFKA
- QueryDSL
- JPA
- Netty
- ChannelPipeline
- spring cloud
- coalesce
- RabbitMQ
- weblogic 10
- WebLogic
- Selenium
- Docker Compose
- Spring Open Feign
- MySQL
- Hibernate
- spring boot
- Airflow
- docker compose mysql
- docker-compose
- spring boot redis
- redis
- mybatis
- argo cd
- jmeter
- grafana
- Redis Sentinel
- netflix oss
- docker
Archives
- Today
- Total
IT.FARMER
spring webflux error 처리 본문
반응형
spring webflux error 처리
Mono / Flux
- .doOnError() : 예외가 발생했을 경우 특정 행위를 실행 시킬대 사용
- .onErrorReturn () : 예외가 발생 했을때 특정 값을 리턴 함
- .onErrorResume() : 예외가 발생 했을때 오류에 따라 대체를 선택하는 기능을 사용함. 오류가 발생하면 반환된 대체 게시자를 구독 하여 사용
- .onErrorContinue() : 예외가 발생 했을대 멈추지 않고 해당 영역만 skip 하고 동작함.
@Slf4j
public class WebFluxError {
@Test
public void onErrorResume() {
Flux.range(0, 5)
.map(integer -> {
if (integer == 3) {
throw new RuntimeException("숫자 = " + 3);
}
return integer;
})
.onErrorResume(throwable -> {
log.error("flux error = {}", throwable.getMessage());
return Flux.range(6,10);
})
.log()
.subscribe()
;
}
}
반응형
'Spring > Spring WebFlux' 카테고리의 다른 글
Spring R2DBC CRUD 예제 (0) | 2021.04.29 |
---|---|
webflux null, empty 처리 (0) | 2020.05.26 |