Reputation: 41909
Given the following 2 Actors, Downloader
and DownloadActor
, the latter actor has a router
, named Router
.
However, when I run sbt run
, I get the following run-time exception:
Caused by: akka.ConfigurationException: Configuration missing for router [akka://Downloader/user/DownloadActor/Router] in 'akka.actor.deployment' section.
Here's my code:
Downloader.scala
object DownloadMain {
val system = ActorSystem("Downloader")
val actor = system.actorOf(Props[DownloadActor], "DownloadActor")
def main(args: Array[String]) {
actor ! new URL("http://www.cis.upenn.edu/~matuszek/index.html")
}
}
DownloadActor.scala
class DownloadActor extends Actor with ActorLogging {
val router = context.actorOf( Props[Worker].withRouter( FromConfig()), "Router")
...
application.conf
akka.actor.deployment {
/Downloader/DownloadActor/Router {
router = "round-robin"
nr-of-instances = 8
}
}
Please let me know which configuration error that I'm making.
I saw this post, but the solution doesn't seem exact (at least to me).
Upvotes: 2
Views: 2628
Reputation: 784
First of all Downloader
is not an actor - this is actor system name which is used to create unique path for the specific actor system, eg.
[akka.tcp://[email protected]:2561/user/DownloadActor/Router]
To answer your question, the path in your deployment config is incorrect, you should use following config.
akka.actor.deployment {
/DownloadActor/Router {
router = "round-robin"
nr-of-instances = 8
}
}
All the actors initialized directly from system
, as in following example
val actor = system.actorOf(Props[DownloadActor], "DownloadActor")
are created under user
guardian and are children of this actor. Please readsupervision and monitoring docs to get more details.
Upvotes: 3