Merge pull request #1989 from akka/wip-3620-doc-deploy-conf-patriknw

=doc #3620 Add unified documentation of deployment section
This commit is contained in:
Patrik Nordwall 2014-02-13 12:21:33 +01:00
commit 12746fe555
4 changed files with 69 additions and 8 deletions

View file

@ -19,7 +19,7 @@ class ConfigDocSpec extends WordSpec with Matchers {
val customConf = ConfigFactory.parseString("""
akka.actor.deployment {
/my-service {
router = round-robin
router = round-robin-pool
nr-of-instances = 3
}
}
@ -31,4 +31,44 @@ class ConfigDocSpec extends WordSpec with Matchers {
TestKit.shutdownActorSystem(system)
}
"deployment section" in {
val conf = ConfigFactory.parseString("""
#//#deployment-section
akka.actor.deployment {
# '/user/actorA/actorB' is a remote deployed actor
/actorA/actorB {
remote = "akka.tcp://sampleActorSystem@127.0.0.1:2553"
}
# all direct children of '/user/actorC' have a dedicated dispatcher
"/actorC/*" {
dispatcher = my-dispatcher
}
# '/user/actorD/actorE' has a special priority mailbox
/actorD/actorE {
mailbox = prio-mailbox
}
# '/user/actorF/actorG/actorH' is a random pool
/actorF/actorG/actorH {
router = random-pool
nr-of-instances = 5
}
}
my-dispatcher {
fork-join-executor.parallelism-min = 10
fork-join-executor.parallelism-max = 10
}
prio-mailbox {
mailbox-type = "a.b.MyPrioMailbox"
}
#//#deployment-section
""")
val system = ActorSystem("MySystem", conf)
TestKit.shutdownActorSystem(system)
}
}

View file

@ -144,6 +144,8 @@ A custom ``application.conf`` might look like this::
stdout-loglevel = "DEBUG"
actor {
provider = "akka.cluster.ClusterActorRefProvider"
default-dispatcher {
# Throughput for default Dispatcher, set to 1 for as fair as possible
throughput = 10
@ -151,10 +153,8 @@ A custom ``application.conf`` might look like this::
}
remote {
server {
# The port clients should connect to. Default is 2552 (AKKA)
port = 2562
}
# The port clients should connect to. Default is 2552.
netty.tcp.port = 4711
}
}
@ -385,6 +385,27 @@ Includes at the top of ``application.conf`` will be overridden by
the rest of ``application.conf``, while those at the bottom will
override the earlier stuff.
Actor Deployment Configuration
------------------------------
Deployment settings for specific actors can be defined in the ``akka.actor.deployment``
section of the configuration. In the deployment section it is possible to define
things like dispatcher, mailbox, router settings, and remote deployment.
Configuration of these features are described in the chapters detailing corresponding
topics. An example may look like this:
.. includecode:: code/docs/config/ConfigDocSpec.scala#deployment-section
The deployment section for a specific actor is identified by the
path of the actor relative to ``/user``.
You can use asterisks as wildcard matches for the actor path sections, so you could specify:
``/*/sampleActor`` and that would match all ``sampleActor`` on that level in the hierarchy.
You can also use wildcard in the last position to match all actors at a certain level:
``/someParent/*``. Non-wildcard matches always have higher priority to match than wildcards, so:
``/foo/bar`` is considered **more specific** than ``/foo/*`` and only the highest priority match is used.
Please note that it **cannot** be used to partially match section, like this: ``/foo*/bar``, ``/f*o/bar`` etc.
Listing of the Reference Configuration
--------------------------------------

View file

@ -82,7 +82,7 @@ The old ``cluster.routees-path`` is deprecated, but still working during the dep
Example::
/router4 {
router = round-robin
router = round-robin-group
nr-of-instances = 10
routees.paths = ["/user/myserviceA", "/user/myserviceB"]
cluster.enabled = on

View file

@ -27,8 +27,8 @@ class RemoteConsistentHashingRouterSpec extends AkkaSpec("""
val consistentHash1 = ConsistentHash(nodes1, 10)
val consistentHash2 = ConsistentHash(nodes2, 10)
val keys = List("A", "B", "C", "D", "E", "F", "G")
val result1 = keys collect { case k => consistentHash1.nodeFor(k).routee }
val result2 = keys collect { case k => consistentHash2.nodeFor(k).routee }
val result1 = keys collect { case k consistentHash1.nodeFor(k).routee }
val result2 = keys collect { case k consistentHash2.nodeFor(k).routee }
result1 should be(result2)
}