I created my custom mailbox called CustomMailBox
which derived from MyUnboundedMessageQueueSemantics
trait. Then i put this configurations into application.conf:
custom-dispatcher {
mailbox-requirement =
"com.MyUnboundedMessageQueueSemantics"
}
akka.actor.mailbox.requirements {
"com.MyUnboundedMessageQueueSemantics" =
custom-dispatcher-mailbox
}
custom-dispatcher-mailbox {
mailbox-type = "com.CustomMailBox"
}
akka.actor.deployment {
/myactor {
dispatcher = custom-dispatcher
}
}
After that i create my actor this way:
val system = ActorSystem("mySystem")
val quadrocopter = system.actorOf(Quadrocopter.props(vrep, clientID, handler)
.withDispatcher("custom-dispatcher"), "myactor")
and after running my program i got this error:
Exception in thread "main" akka.ConfigurationException: Dispatcher [custom-dispatcher] not configured for path akka://mySystem/user/myactor
at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:758)
at akka.actor.dungeon.Children$class.makeChild(Children.scala:273)
at akka.actor.dungeon.Children$class.attachChild(Children.scala:46)
at akka.actor.ActorCell.attachChild(ActorCell.scala:374)
at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:732)
at Simulation$.delayedEndpoint$Simulation$1(Simulation.scala:24)
at Simulation$delayedInit$body.apply(Simulation.scala:12)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at Simulation$.main(Simulation.scala:12)
at Simulation.main(Simulation.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Can anybody explain me what is wrong in that?
Problem solved by changing /myactor
to " */myactor"
in config file. Second step is to remove invocation of withDispatcher()
function when creating actor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.