Upgraded routing documentation to Akka 2.0. See #1063
This commit is contained in:
parent
73b79d6e3e
commit
41ce42c8f7
8 changed files with 495 additions and 189 deletions
|
|
@ -0,0 +1,22 @@
|
|||
package akka.docs.routing
|
||||
|
||||
import com.typesafe.config.{ ConfigFactory, Config }
|
||||
import akka.actor.{ Actor, Props, ActorSystem }
|
||||
import akka.routing.RoundRobinRouter
|
||||
|
||||
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 system = ActorSystem("Example")
|
||||
//#configurableRouting
|
||||
val router = system.actorOf(Props[PrintlnActor].withRouter(RoundRobinRouter()),
|
||||
"exampleActor")
|
||||
//#configurableRouting
|
||||
1 to 10 foreach { i ⇒ router ! Message(i) }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue