How to do it...

For this recipe, we need to perform the following steps:

  1. We need to bring the required dependencies.
  2. Edit the build.sbt file and add Akka Stream dependency, as follows:
        libraryDependencies += "com.typesafe.akka" % "akka-        contrib_2.11" % "2.4.4"
  1. To begin with, let's create an actor that simulates getting latest posts from a social network. Create a file named SocialMediaHandler.scala inside the com.packt.chapter10 package. The content should look like this:
        package com.packt.chapter10        import akka.actor.{Actor, ActorLogging}        import com.packt.chapter10.SocialMediaAggregator.        {GetLatestPosts, LatestPostResult, Post}        import scala.util.Random        class SocialMediaHandler(socialMedia: String) extends Actor          with ActorLogging ...

Get Akka Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.