In the example from the akka 1.1 documentation for compiling futures , I wonder how to programmatically set the timeout of the generated future. I know that I can set the global timeout in akka.conf, but I want to do this only for this piece of code.
Sample code is as follows
val f1 = actor1 !!! msg1 val f2 = actor2 !!! msg2 val f3 = for { a: Int <- f1 b: Int <- f2 c: String <- actor3 !!! (a + b) } yield c val result = f3.get()
Is it correct that in this example, akka creates a total of four futures?
- One for each message is sent to actor1, 2 and 3
- One to wrap these three futures
It is easy to change timeouts in the first case, for example.
val f1 = actor1 !!! (msg1, 15000)
but how can I set a timeout for future packaging? Any ideas?
source share