How to Write Controllable Futures in Scala | Rock the JVM
ฝัง
- เผยแพร่เมื่อ 7 ก.พ. 2025
- Written form to keep for later: blog.rockthejv...
This video is for the Scala programmers who are facing the problem of "manually" fulfilling Futures. I give the prototypical example of what happens in practice, when you have a multi-threaded service out of your control, yet you need to use it and extract a sensible API out of it.
I will introduce Promises, how they work, how they fit into the producer-consumer paradigm, and solve the problem at hand.
Follow Rock the JVM on:
LinkedIn: / rockthejvm
Twitter: / rockthejvm
Blog: rockthejvm.com...
-------------------------------------------------------------------------
Home: rockthejvm.com
-------------------------------------------------------------------------
I started an new job that uses Scala and your videos have helped me tremendously. Thank you
Glad to have played a small part!
jeez that was a mind trip for my smooth brain
Feeling Good to see you here I have learned Scala bcz of you
Good tutorial again! But the implementation itself is too messy for just realizing a simple idea, "process a value from Future"?
The problem the video wants to show is how to deterministically fulfil a Future, not necessarily how to process it.
This example for Promises seems slightly convoluted, but it eventually drives the idea home. Keep up the good work otherwise ;)
Glad it eventually clicked!
Hi Daniel, really helpful video. But I have one different scenario. Lets say, I have one batch process which is using Slick. Now by design Slick returns Future. If I want executes Futures in a sequential way and want the main method to wait until all the Futures are executed then what could be the best possible implementation. Right now I am using Await though. If anything other than using Await.
Use Future.traverse or Future.sequence.
I can't make the code run and the link to the blog is broken. In the blog index there is this link, also broken (rockthejvm.com/blog/205441/conttrollable-futures). Any help will be appreciated
I learn a lot with you videos.
Thank you
Things have gone very much confusing here Daniel, would have been better to take a simple example to explain why and where need to play with a promise manually.
That was the goal of the video :(
Hi Daniel, thanks for the video. I sent you an email regarding your udemy courses. Could you please check it when you have time?