package eu.xeppaka.scalalearn

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import eu.xeppaka.scalalearn.Actor1.{Print, Start}

import scala.io.StdIn
import scala.concurrent.duration._

object Main12 {
  def main(args: Array[String]): Unit = {
    val actorSystem = ActorSystem()
    //val materializer = ActorMaterializer()(actorSystem)

    try {
      val actor2 = actorSystem.actorOf(Actor2.props())
      val actor1 = actorSystem.actorOf(Actor1.props(actor2))

      actorSystem.scheduler.schedule(1.second, 10.millis, actor1, Print)(actorSystem.dispatcher)

      actor1 ! Start

      StdIn.readLine()
    } finally {
      actorSystem.terminate()
    }
  }
}
