| by admin | No comments

COMPOSABLE FUTURES WITH AKKA PDF

“Composable Futures with Akka ” features Java and Scala code examples. The book is available in PDF format. Akka is hot, and Akka. Writing concurrent programs that can run in multiple threads and on multiple cores is crucial but daunting. Composable futures provide a convenient abstraction. Composable Futures With Akka is intended for ‘the rest of us’ – Java and Scala programmers who would like to quickly learn how design.

Author: Kirg Gardajora
Country: Gabon
Language: English (Spanish)
Genre: Science
Published (Last): 25 January 2008
Pages: 40
PDF File Size: 3.69 Mb
ePub File Size: 9.30 Mb
ISBN: 978-6-95420-425-5
Downloads: 64524
Price: Free* [*Free Regsitration Required]
Uploader: Kizahn

Sometimes you just want to listen to a Future being completed, and react to that not by creating a new Futurebut by side-effecting. In this example we are joining two strings together within a Future. A common use case for this is combining the replies of several Actor s into a single calculation without resorting to calling Await.

Target Audience Composable Futures with Akka 2. To wait for and retrieve the actual result the simplest method is:.

You can also combine two Futures into a new Future that will hold a tuple of the two Futures successful results, using the zip operation. See next section for examples. For example, to use traverse to sum the first odd numbers: Future counterpart in Java; conversion from scala. Futrues 8 CompletableFuture creates a new instance of CompletableFuture for any new stage, which means scala-java8-compat implementation is not used after the first mapping method. Dozens of complete working code examples are provided with the book, at least one per method in each language.

  JOSE EMILIO PACHECO LA ZARPA PDF

Mike Slinn – Connoisseur of Technology: Composable Futures with Akka

If you find yourself creating a pool of Actor s AbstractActor s for the sole reason of performing a calculation in parallel, there is an easier and faster way:. CompletionStage instances returned by Akka it falls back to standard behavior of Java CompletableFuture. Even if the Future has already been completed, when one of witb methods is called. The map method is fine if we are modifying a single Futurebut if 2 or more Future s are involved map will not allow you to combine them together:.

Something to keep in mind when doing this is even though it looks like parts of the above example can run in parallel, each step of the for comprehension is run sequentially.

If the sequence passed to fold is empty, it will return the start-value, in the case above, that will be 0. This is the same result as this example: Akka futures is integrated with Akka actors for distributed computing. For example, transformations and operations on collections of futures are supported, along with numerous asynchronous callbacks.

The blocking operations are located in Await.

Composable Futures with Akka 2.0

Future is done using scala-java8-compat library. The source code for this page can be found here.

  JAMIE OLIVER KNYGA PDF

The Promises chapter in the book includes a case study that shows how easy it is to integrate Akka futures into existing code. Using pipeTo pipe with the?

Composable Futures with Akka

The scala-java8-compat library returns its own implementation of CompletionStage which delegates all non-async methods to their async counterparts. Now compare that to this example: Starting with Akka 2. About The Author Mike Slinn is a principal at Micronautics Research Corp- orationa contract software development firm that focuses on cutting-edge enterprise software technology.

Something to note when using these methods: It is also possible to create an empty Promiseto be filled later, and obtain the futured Future:. Mike is a hands-on architect who enjoys programming and mentoring.

Akka Futures can also be preset to a value or exception when created. If you know Java and are learning Scala, comparing the two programs will be instructive.

Found an error in this documentation? The code is provided as a git repository, which you can update any time. CompletionStage also has async methods which take Executor as a second parameter, just like Future:.