일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- aws cicd
- codebuild
- Kafka
- Python
- Spring
- aws
- node
- Airflow
- codepipeline
- bootstrap
- 도커
- docker
- JavaScript
- IntelliJ
- Spring Error
- codedeploy
- redis
- VPN
- or some instances in your deployment group are experiencing problems.
- chart.js
- Jenkins
- PostgreSQL
- chartjs
- Flux
- kubeflow
- AWS CI/CD 구축하기
- codedeploy error
- java bigdecimal
- COALESCE
- SQL
- Today
- Total
Small Asteroid Blog
[webflux] PublishOn, SubscribeOn 본문
WebFlux를 사용하는데 있어서, publisher와 subscriber 모델의 개념을 이해하는데까지 시간이 많이 소요가 되었다.
mvc로 개발할 때는 메서드 호출만 하면 결과값이 return이 되었다.
webflux를 사용해 비동기식으로 개발을 할 때는 메서드만 호출해서는 원하는 결과를 얻기가 힘들다.
webflux에서는 subscribe(구독) 을 해야 동작을 한다.
PublishOn
- 신호 처리 스케줄링으로
- onNext, onComplete, onError 가 지정된 Scheduler 의 스레드에서 신호 처리 스레드 설정
- 다음 PublishOn을 만날 때까지 같은 스레드에서 동작
- 안만나면 동작 끝내고 마침

SubscribeOn
- 시퀀스를 실행할 스레드를 결정
- PublishOn을 만날 때까지 같은 스레드에서 동작
- PublishOn이 신호를 처리할 스레드를 지정하므고 PublishOn 뒤에 오는 SubscribeOn 은 무시됨

참고
publishOne
Flux (reactor-core 3.4.17)
Uses a resource, generated by a supplier for each individual Subscriber, while streaming the values from a Publisher derived from the same resource and makes sure the resource is released if the sequence terminates or the Subscriber cancels. Eager resource
projectreactor.io
subscribeOn
Flux (reactor-core 3.4.17)
Uses a resource, generated by a supplier for each individual Subscriber, while streaming the values from a Publisher derived from the same resource and makes sure the resource is released if the sequence terminates or the Subscriber cancels. Eager resource
projectreactor.io
'백엔드 > Spring' 카테고리의 다른 글
Connection Factory (0) | 2022.05.13 |
---|---|
Reactive Streams (0) | 2022.04.16 |
Spring WebFlux (0) | 2022.04.14 |
[Intellij] JUnit Test 실행 시 No tests found for given includes (0) | 2022.04.14 |
[spring] @Test 빌드시 ' Cannot find symbol method' 에러 (0) | 2022.04.13 |