Skip to Content
Mastering Functional Programming
book

Mastering Functional Programming

by Anatolii Kmetiuk
August 2018
Intermediate to advanced
380 pages
10h 2m
English
Packt Publishing
Content preview from Mastering Functional Programming

Implementation

First of all, let's have a look at the API we want and its usage:

val system = ActorSystem("PiSystem")val root = system actorOf Worker.workerProps(root ? Job(new URL("http://mvnrepository.com/"), 1)).onSuccess {  case Result(res) =>  println("Crawling finished successfully")  println(res.take(10).mkString("\n"))  println(res.size)}

In the preceding code, you can see the main method of the parallelized actor application. As you can see, we create an actor system and a root-level worker actor. The idea is to represent all of the processing actors as a single class, Worker. The job of a single worker is to process a single URL and spawn additional workers to process the links extracted from it.

Next, you can see an example of querying ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781788620796Supplemental Content