diff --git a/spring/webflux/Reactor.md b/spring/webflux/Reactor.md index 0528767..f074f64 100644 --- a/spring/webflux/Reactor.md +++ b/spring/webflux/Reactor.md @@ -408,3 +408,10 @@ Flux.generate(() -> 0, (s, sink) -> { ``` #### 异步多线程生成`create` +`Flux.create`针对每个round能够产生多个元素,其暴露的sink类型为`FluxSink`。相对于`Flux.generate`,`Flux.create`方法并没有接收`state`的重载版本。 + +> `Flux.create`并不会将你的代码变为并行或是异步的. +> +> 如果在`Flux.create`中存在阻塞操作,那么将存在死锁的风险。即使使用了`subscribeOn`方法,在create lambda中执行长阻塞操作仍然会阻塞item的处理,因为item的source产生和下游处理都处于同一线程中,但是上游对线程的阻塞可能导致下游的消费逻辑无法被执行。 +> +> \ No newline at end of file