Spring WebFlux create pool of no-blocking threads

偶尔善良 提交于 2020-01-02 12:49:49

问题


I decided to rewrite my web app on Java(previously it was on Python). In my app I used no-blocking I/O, I had worker pool(Celery + Eventlet threads) where I pass tasks which consists of hundreds of API calls.

Now I'm using Spring WebFlux but I can't understand how I can create a workers pool to pass my tasks to that pool, and after get results and do some calculations.

(I know about possibility to create ThreadPoolTaskExecutor, but the threads are blocking threads)


回答1:


If you're using non-blocking APIs, you don't need to schedule tasks on specific threads - Reactor is doing that for you. With Spring WebFlux, the threads used for processing work are managed by Reactor or it is reusing the Netty threads.

Check out the Schedulers and threading parts of the reactor reference documentation.



来源:https://stackoverflow.com/questions/48012749/spring-webflux-create-pool-of-no-blocking-threads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!