两个 Actor 的通讯机制原理图 目录结构: 代码: AActor.scala package com.akka.actors import akka.actor.{Actor, ActorRef} class AActor(actorRef: ActorRef) extends Actor { val bActorRef: ActorRef = actorRef override def receive: Receive = { case "start" => { println("AActor 出招了 , start ok") self ! "我打" //发给自己 } case "我打" => { //给 BActor 发出消息 //这里需要持有 BActor 的引用(BActorRef) println("AActor(黄飞鸿) 厉害 看我佛山无影脚") Thread.sleep(1000) bActorRef ! "我打" //给 BActor 发出消息 } } } BActor.scala package com.akka.actors import akka.actor.Actor class BActor extends Actor { override def receive: Receive = { case "我打" => { println("BActor