Reactive Schedulers in Spring Webflux | Reactor execution model | subscribeOn vs publishOn operator
Ғылым және технология
#ReactiveProgramming #Schedulers #publishOnVsSubscribeOn
In this video, I have explained the Reactor execution model along with different reactive Schedulers. I have explained different types of Scheduler (immediate, single, parallel, elastic, boundedElastic) and its real use case. Also demonstrate how to change the execution context using different operators (subscribeOn, publishOn, runOn). I have covered the differences between subscribeOn, publishOn, and runOn operators.
Stay tuned.....
Happy Coding :)
GitHub repo link:
github.com/sunny-shaw?tab=rep...
======================
Important playlists
======================
Kotlin Coroutines: • Tutorial #1 | Kotlin C...
Reactive Programming: • Tutorial #1 | Introduc...
Data Structures • Introduction to Data S...
Linux: • How to use VIM/VI edit...
SonarQube: • Install and configure ...
======================
You can follow me on:
======================
Instagram: / engineerhooon
LinkedIn: / sunny-shaw
Medium: / sunnyshaw_12357
GitHub: github.com/sunny-shaw
=============================================================
|| Subscribe and hit the bell button to get latest content ||
=============================================================
Пікірлер: 27
Thank you, I have followed your playlist about reactive programming. It is very useful, really appreciate your help. Your channel will soon grow, Keep posting such videos.
@Engineerhooon
4 жыл бұрын
Awesome! Thanks for the love and support. :)
Thanks so much for very clear and good explaination
@Engineerhooon
4 ай бұрын
Glad it was helpful.
Thank you so much brother ..realy explaining very well
@Engineerhooon
7 ай бұрын
Glad it was helpful.
What an amazing video! So clearly explain such muddy theme! Thank you a lot!
@Engineerhooon
Жыл бұрын
Glad you enjoyed it!
Thank you man! Great explanation.
@Engineerhooon
Жыл бұрын
You're welcome! Glad it was helpful.
Good Work , Keep it up . Thanks
@Engineerhooon
3 жыл бұрын
Welcome 🙃
Great explanation thx.
@Engineerhooon
3 жыл бұрын
Welcome!
Nice video
@Engineerhooon
8 ай бұрын
Thank you!
Thanks. What is default sceduler and on exact what requirrement we can use these schedulers. I didn't find out the scenarios for different use cases. However the video is very explanatory and understandable. Thanks
@Engineerhooon
2 жыл бұрын
Default runs on the main thread
Nicely explained
@Engineerhooon
3 жыл бұрын
Thank you. Please share this video for better reach. Stay tuned more videos are coming soon!
@sandeepkumar-bl8jb
3 жыл бұрын
@@Engineerhooon please create more videos on spring reactive
@Engineerhooon
3 жыл бұрын
@@sandeepkumar-bl8jb Sure. Thanks for your suggestion.
Thanks
@Engineerhooon
4 жыл бұрын
Welcome
Hi and thanks for the video, one question around 14:30 you introduce example where Mono is subscribed to run on elastic scheduler using publishOn method. around 17:00 you introduce the same Mono but instead of publishOn you scheduled it to be ran via subscribeOn. Why the example with publishOn isn't requiring the sleep (at the end of the test) to prevent the JVM from exiting?
@Engineerhooon
Жыл бұрын
I have explained the reason for it. Please watch it once again. It depends on the type of thread used for execution. For main thread execution no sleep required whereas if the execution is on another thread then main thread needs to be blocked. Try it out for better understanding. Let me know if that helps.
Hi, i am trying to write a code where request comes to the rest controller and controller calls a helper. Helper internally calls a validator for validating the request. Suppose request has a list of string that I want to validate with the list present in db. I do have a repository that returns Flux of String. problem is i am not able to block the code to validate and return a mono. Tried publishOn to go into different thread to make the validation but looks like it is not helping. Below is the piece of code of validator method private Mono validateBooks(List books) { return bookManager.getAllBooks() .publishOn(Schedulers.boundedElastic()) .map(bookDTO -> bookDTO.getId()) .collectList() .flatMap(booksList -> Mono.just(booksList.stream().allMatch(book -> booksList.contains(book)))) .doOnNext(System.out::println) .flatMap(isValid -> { if(!isValid){ return Mono.just(new ErrorBean(40001, "book id do not match")); }else{ return Mono.empty(); } }); }