call methods on akka actors in scala

前端 未结 3 2239
甜味超标
甜味超标 2021-02-20 15:10

I have a an actor defined as so:

class nodeActor(ID: String) extends Actor

which contains a method, which is used to set up the actor before it

3条回答
  •  一整个雨季
    2021-02-20 15:32

    If you want to do this for testing then when creating actor you can just do this:

    import akka.testkit.TestActorRef
    val actorRef = TestActorRef[MyActor]
    val actor = actorRef.underlyingActor
    

    Then you can run methods on actor

提交回复
热议问题