Search
โ˜•

WebFlux ํ๋ฆ„

โ€ข
WebFlux ๋Š” ํฌ๊ฒŒ ๋‘ ๋ถ€๋ถ„์œผ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.
โ—ฆ
publisher ์ƒ์„ฑ ๋ถ€๋ถ„
โ—ฆ
publisher subscribe ๋ถ€๋ถ„
โ€ข
์ด ๋‘ ๋ถ€๋ถ„์€ reactor.netty.http.server ํŒจํ‚ค์ง€์˜ HttpServer$onStateChange ๋ฉ”์„œ๋“œ์—์„œ ์‹คํ–‰๋œ๋‹ค.
โ—ฆ
Publisher<Void> publisher = (Publisher)this.handler.apply(ops, ops);
โ—ฆ
mono.subscribe(ops.disposeSubscriber());

HttpWebHandlerAdapter

โ€ข
publisher ์ƒ์„ฑ ํ•ต์‹ฌ ํด๋ž˜์Šค
โ€ข
handle ํ˜ธ์ถœ๋˜๋Š” ๊ณผ์ •
โ—ฆ
this.handler.apply(ops, ops) โ†’ ReactorHttpHandlerAdapter$apply ํ˜ธ์ถœ
โ–ช
ReactorHttpHandlerAdapter ์—์„œ๋Š” request ์™€ response ๋ฅผ ์ƒ์„ฑ
ReactorServerHttpRequest request = new ReactorServerHttpRequest(reactorRequest, bufferFactory); ServerHttpResponse response = new ReactorServerHttpResponse(reactorResponse, bufferFactory);
JavaScript
๋ณต์‚ฌ
โ—ฆ
this.httpHandler.handle(request, response) โ†’ WebServerManager$DelayedInitializationHttpHandler$handle ํ˜ธ์ถœ
โ—ฆ
this.delegate.handle(request, response) โ†’ HttpWebHandlerAdapter$handle ํ˜ธ์ถœ
โ€ข
exchange ์ƒ์„ฑ
ServerWebExchange exchange = this.createExchange(request, response);
JavaScript
๋ณต์‚ฌ
โ€ข
ExceptionHandlingWebFilter, FilteringWebHandler โ†’ extends WebHandlerDecorator
โ€ข
DefaultWebFilterChain$filter ์—์„œ Mono.defer(() โ†’ {}) ๋กœ Mono defer ๋ฅผ ๋งŒ๋“ ๋‹ค.

DispatcherHandler

โ€ข
subscribe ํ•ต์‹ฌ ํด๋ž˜์Šค
โ€ข
subscribe ํ•˜๋ฉด DefaultWebFilterChain$filter {} ์•ˆ์˜ handler.handle() ๋กœ DispatcherHandler ๊ฐ€ ํ˜ธ์ถœ๋จ.