Skip to content

Commit

Permalink
Implement routing
Browse files Browse the repository at this point in the history
  • Loading branch information
ygunayer committed Apr 17, 2017
1 parent 3314596 commit 99d18a0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/main/resources/application.conf
Expand Up @@ -5,6 +5,13 @@ akka {
debug {
lifecycle = on
}

deployment {
/foo {
router = round-robin-pool
nr-of-instances = 5
}
}
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/com/yalingunayer/foo/Application.scala
@@ -1,10 +1,12 @@
package com.yalingunayer.foo

import akka.actor.ActorSystem
import akka.routing.FromConfig
import com.typesafe.config.ConfigFactory

object Application {
def main(args: Array[String]): Unit = {
val foo = ActorSystem("Foo")
foo.actorOf(FooActor.props())
foo.actorOf(FooActor.props().withRouter(FromConfig()), name = "foo")
}
}
2 changes: 1 addition & 1 deletion src/main/scala/com/yalingunayer/foo/FooActor.scala
Expand Up @@ -11,7 +11,7 @@ class FooActor extends Actor {
def receive = {
case s: String => {
println(f"Received a message: $s")
sender ! f"Hello!"
sender ! f"Hello from ${self.path}!"
}
}

Expand Down

0 comments on commit 99d18a0

Please sign in to comment.