While reading the Akka Doc, I came across this code snippet:
val probe = TestProbe()
val future = probe.ref ? "hello"
probe.expectMsg(0 millis, "hello") // TestActor runs on CallingThreadDispatcher
probe.reply("world")
assert(future.isCompleted && future.value == Some(Success("world")))
I know that actor created by TestActorRef is on CallingThreadDispatcher. But I don't quite understand why the TestActor created by TestProbe() is also on CallingThreadDispatcher.
In another part of the Akka Doc, you can obviously use timeout with probe. So I'm confused about whether probe runs in the same thread?
probe1.expectMsg(500 millis, "hello")
Aucun commentaire:
Enregistrer un commentaire