Je suis tombé sur ce code et je me demande ce que fait CallingThreadDispatcher. Je peux commenterQue fait CallingThreadDispatcher?
val dispatcherId = CallingThreadDispatcher.Id
val props = Props[Greeter].withDispatcher(dispatcherId)
et ce test fonctionne toujours
class GreeterTest extends TestKit(testSystem)
with WordSpecLike
with MustMatchers
with StopSystemAfterAll {
"The Greeter" must {
"say Hello World! when a Greeting(\"World\") is sent to it" in {
val dispatcherId = CallingThreadDispatcher.Id
val props = Props[Greeter].withDispatcher(dispatcherId)
val greeter = system.actorOf(props)
EventFilter.info(message = "Hello World!", occurrences = 1).intercept {
greeter ! Greeting("World")
}
}
}
}
object GreeterTest {
val testSystem = {
val config = ConfigFactory.parseString("""akka.loggers = [akka.testkit.TestEventListener]""")
ActorSystem("testSystem", config)
}
}
Alors qu'est-ce que CallingThreadDispatcher faire? et pourquoi en avons-nous besoin?