Spring Boot Reactive Programming Webflux map vs flatMap, log and filter Flux

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • What is the difference on the webflux Flux map and flatMap methods?
    Enjoy! :-)
    Thank you for commenting and asking questions.
    Get 25 % discount on your Minecraft servers at Shockbyte.com by using this refferal link:
    shockbyte.com/...
    The code is located here:
    github.com/eki...
    Follow me on twitter:
    / mikemoelnielsen
    Support me on Patreon:
    / mikemoellernielsen
    As an Amazon Associate I earn from qualifying purchases.
    Check out the stuff that I like (always updated):
    kit.co/MikeMoe...

Komentáře • 10

  • @kennethyu-1
    @kennethyu-1 Před rokem +1

    This was really informative. Thank you!

    • @MikesTechCorner
      @MikesTechCorner  Před rokem

      You are welcome. Thank you for watching and commenting

  • @vivekverma9512
    @vivekverma9512 Před 3 lety +2

    Thanks Mike :)

  • @qSwytch
    @qSwytch Před 2 lety +1

    Thanks for the video. I am still wrapping my head around the reactive programming paradigm. Quick question:
    Way I understand is how your code works is that ".map" is also async and as soon as it returns a single ship, it passes it straight to the ".flatMap" which does its own processing of THAT 1 ship. First .map does not wait for all the ships to be "loaded" before sending them to the next process?
    Assuming this simulates a DB call (findById), would you say reactive approach is still preferred if your DB was simply returning 1 ship (Or based on this example - your Flux only had 1 ship? Or would that be an overkill?
    Once again, great walkthroughs.

    • @MikesTechCorner
      @MikesTechCorner  Před 2 lety

      With reactive programming nothing waits for anything unless you want it to. The point is to receive and send data async because it can then be done more efficient. If you don't need the extra "power" then it is easier to use and debug a classic http rest endpoint. :-)

  • @angelinaoberoi8006
    @angelinaoberoi8006 Před rokem +1

    Thanks for the video. I am new to reactive programming. Quick Question: As in the example shown the flow of code reaches end of the programme before processing the code in the flatmap, what if we want the code to run the code in flatmap first then reach the end of code and return a particular value which was processed in flatmap?

    • @MikesTechCorner
      @MikesTechCorner  Před rokem

      You can force the promise to wait. Check out javascript doc. search for await

  • @mister_tompkin
    @mister_tompkin Před rokem +1

    map is transform with sync
    flatmap is transform with async
    right?