The idea is to filter the sources, replacing @<var>@ occurrences with the mapping for <var> (which is currently hard-coded). @@ -> @. In order to make this work, I had to move the doc sources one directory down (into akka-docs/rst) so that the filtered result could be in a sibling directory so that relative links (to _sphinx plugins or real code) would continue to work. While I was at it I also changed it so that WARNINGs and ERRORs are not swallowed into the debug dump anymore but printed at [warn] level (minimum). One piece of fallout is that the (online) html build is now run after the normal one, not in parallel.
52 lines
No EOL
1.3 KiB
Scala
52 lines
No EOL
1.3 KiB
Scala
/**
|
|
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
|
*/
|
|
package docs.routing
|
|
|
|
import akka.actor.{ Actor, Props, ActorSystem }
|
|
import com.typesafe.config.ConfigFactory
|
|
import akka.routing.FromConfig
|
|
|
|
case class Message(nbr: Int)
|
|
|
|
class ExampleActor extends Actor {
|
|
def receive = {
|
|
case Message(nbr) ⇒ println("Received %s in router %s".format(nbr, self.path.name))
|
|
}
|
|
}
|
|
|
|
object RouterWithConfigExample extends App {
|
|
val config = ConfigFactory.parseString("""
|
|
//#config
|
|
akka.actor.deployment {
|
|
/router {
|
|
router = round-robin
|
|
nr-of-instances = 5
|
|
}
|
|
}
|
|
//#config
|
|
//#config-resize
|
|
akka.actor.deployment {
|
|
/router2 {
|
|
router = round-robin
|
|
resizer {
|
|
lower-bound = 2
|
|
upper-bound = 15
|
|
}
|
|
}
|
|
}
|
|
//#config-resize
|
|
""")
|
|
val system = ActorSystem("Example", config)
|
|
//#configurableRouting
|
|
val router = system.actorOf(Props[ExampleActor].withRouter(FromConfig()),
|
|
"router")
|
|
//#configurableRouting
|
|
1 to 10 foreach { i ⇒ router ! Message(i) }
|
|
|
|
//#configurableRoutingWithResizer
|
|
val router2 = system.actorOf(Props[ExampleActor].withRouter(FromConfig()),
|
|
"router2")
|
|
//#configurableRoutingWithResizer
|
|
1 to 10 foreach { i ⇒ router2 ! Message(i) }
|
|
} |