Skip to content

Instantly share code, notes, and snippets.

@Mortimerp9
Last active December 27, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mortimerp9/7258790 to your computer and use it in GitHub Desktop.
Save Mortimerp9/7258790 to your computer and use it in GitHub Desktop.
class MyActor extends Actor {
var driver: ActorRef = null
val identifyId = //get a unique identifyId for that driverUrl
override def preStart() {
val driverSel = context.actorSelection(driverUrl)
driverSel ! Identify(identifyId)
}
private def waitingForDriver: Receive = {
case ActorIdentity(identifyId, Some(actorRef)) =>
val timeout = 100.millis
driver = context.actorOf(Props(classOf[ReliableProxy], actorRef, timeout))
driver ! RegisterExecutor(executorId, hostPort, cores)
context.system.eventStream.subscribe(self, classOf[RemotingLifecycleEvent])
context watch driver
context become mainReceive
}
private def mainReceive: Receive = {
// the current receive
}
override def receive = waitingForDriver
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment