For this recipe, we need to perform the following steps:
- We need to bring the required dependencies.
- Edit the build.sbt file and add Akka Stream dependency, as follows:
libraryDependencies += "com.typesafe.akka" % "akka- contrib_2.11" % "2.4.4"
- 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 ...