COMPOSABLE FUTURES WITH AKKA PDF


0
Categories : Business

“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: Dabar Grogor
Country: Malaysia
Language: English (Spanish)
Genre: Relationship
Published (Last): 24 October 2009
Pages: 438
PDF File Size: 9.85 Mb
ePub File Size: 13.98 Mb
ISBN: 970-7-68083-428-1
Downloads: 14689
Price: Free* [*Free Regsitration Required]
Uploader: Meztigami

Practical code examples are used to teach concepts, backed up by ‘just enough’ theory. The Akka and Twitter implementations are much more advanced.

Composable Futures with Akka 2.0

About Contents Change history No longer available. Java programmers do not require prior experience with Scala; Scala programmers do not need to know Java. An overview of futures is provided through code examples.

When non-async methods are applied on a not yet completed CompletionStagethey are completed by the thread which completes initial CompletionStage:.

Composable Futures with Akka | Mike Slinn’s Weblog

Now we have a second Futuref2that will eventually contain an Int Integer. Akka futures has a Fytures API, and it provides Java programs with almost every bit of the same futures capability available to Scala programs. Future which has async methods only, CompletionStage has async and wit methods. Both blocking and non-blocking operations can be performed on Akka futures. For example, transformations and operations on collections of futures are supported, along with numerous asynchronous callbacks.

There are generally two ways of getting a reply from an Actor AbstractActor: Multicore concurrency requires multi-threaded programming, but that is hard to do properly. CompletionStage instances returned by Akka it falls back to standard behavior of Java CompletableFuture. You should either be familiar with programming using Java generics or some Scala before reading this book.

  ISO 6506-4 PDF

Non-async methods When non-async methods are applied on a not yet completed CompletionStagethey are completed by the thread which completes initial CompletionStage: Futufes holds the data in memory, so that it can return the current state of the user data quickly upon a request. The futures implementation provided by Akka 1. Akka futures integrate easily with existing software projects.

When using non-blocking it is better to use the mapTo method to safely try to cast a Future to an expected type: That is why the asInstanceOf cast to String is used in the above sample. For these examples PrintResult is defined as follows: In order to execute callbacks and operations, Futures need something called an ExecutionContextwhich is futurez similar to a java.

Each method of the Ocmposable futures implementation is covered in detail; first introduced with short explanation, then followed by the Java signature and the Scala signature. In this example we are joining two strings together within a Future. The pipe pattern can be used by importing akka. You can also use the SBT console to try code snippets interactively.

When in doubt, async methods with explicit executor should be used. After adding any additional computation stage to CompletionStage returned by scala-java8-compat e. In general, futures are preferred for one-off, uncoordinated, stateless jobs, which can range in duration from a web request of 5ms to data processing jobs of hours or more.

He is often engaged to turn around projects and can provide interim technical leadership for companies in transition. If a Future does contain an Exceptioncalling Await.

  AMORC MASTERY LIFE PDF

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: You can also use the recoverWith method, which has the same relationship to recover as flatMap has to mapand is use like this:.

Some familiarity with git is assumed. Future counterpart in Java; conversion from scala. Akka futures are being subsumed into Scala 2. CompletionStage also has async methods which take Executor as a second parameter, just like Future:.

Since the result of a Future is created concurrently to the rest of the program, exceptions must be handled differently. Akka Futures can also be preset to a value or exception when created.

Now compare that to this example: 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:. This is done with the recover method. Instead, the flatMap method should be used: Dozens of complete working code examples are provided with the book, at least one per method in each language. Mike has consulted on many legal cases and performed project failure analysis, and has researched and testified in cases involving intellectual property issues such as patent infringement and trade secret misappropriation.