August 2018
Intermediate to advanced
380 pages
10h 2m
English
To keep the example simple, in the parallel example we have used the fetch function from the sequential example to fetch the contents of a certain URL:
val links = fetch(url).getOrElse(Set()).filter(!visited(_))
The motivation for having this function return an Option was fault tolerance in the sequential example—if the result cannot be computed, we return a None. However, in an actor setting, Akka provides you with a framework to specify what to do if an actor has failed. So in principle, we could further refine our example with a dedicated fetch function that is perfectly capable of throwing exceptions. However, you might want to specify the actor-level logic on how to restart itself and how to keep its state through this ...