Remove actor dsl (#26784)
* Removals of actor dsl * Mima for actor dsl removal * Remove inbox doc test * Keep main in echo server example
This commit is contained in:
parent
8b3fbe8107
commit
39b344c508
15 changed files with 20 additions and 1649 deletions
|
|
@ -6,34 +6,24 @@ package docs.io
|
|||
|
||||
import java.net.InetSocketAddress
|
||||
|
||||
import scala.concurrent.duration.DurationInt
|
||||
|
||||
import com.typesafe.config.ConfigFactory
|
||||
|
||||
import akka.actor.{ Actor, ActorDSL, ActorLogging, ActorRef, ActorSystem, Props, SupervisorStrategy }
|
||||
import akka.actor.ActorDSL.inbox
|
||||
import akka.actor.{ Actor, ActorLogging, ActorRef, ActorSystem, Props, SupervisorStrategy }
|
||||
import akka.io.{ IO, Tcp }
|
||||
import akka.util.ByteString
|
||||
|
||||
import scala.io.StdIn
|
||||
|
||||
object EchoServer extends App {
|
||||
|
||||
val config = ConfigFactory.parseString("akka.loglevel = DEBUG")
|
||||
implicit val system = ActorSystem("EchoServer", config)
|
||||
|
||||
// make sure to stop the system so that the application stops
|
||||
try run()
|
||||
finally system.terminate()
|
||||
|
||||
def run(): Unit = {
|
||||
import ActorDSL._
|
||||
|
||||
// create two EchoManager and stop the application once one dies
|
||||
val watcher = inbox()
|
||||
watcher.watch(system.actorOf(Props(classOf[EchoManager], classOf[EchoHandler]), "echo"))
|
||||
watcher.watch(system.actorOf(Props(classOf[EchoManager], classOf[SimpleEchoHandler]), "simple"))
|
||||
watcher.receive(10.minutes)
|
||||
}
|
||||
system.actorOf(Props(classOf[EchoManager], classOf[EchoHandler]), "echo")
|
||||
system.actorOf(Props(classOf[EchoManager], classOf[SimpleEchoHandler]), "simple")
|
||||
|
||||
println("Press enter to exit...")
|
||||
StdIn.readLine()
|
||||
system.terminate()
|
||||
}
|
||||
|
||||
class EchoManager(handlerClass: Class[_]) extends Actor with ActorLogging {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue