java docs for Artery, #21209

* and a few other things
* fixed some remaining akka.tcp
This commit is contained in:
Patrik Nordwall 2016-09-30 18:20:47 +02:00
parent 4a4f9c76f9
commit 7af814d3df
13 changed files with 848 additions and 39 deletions

View file

@ -19,7 +19,8 @@ class ByteBufferSerializerDocSpec {
// Implement this method for compatibility with `SerializerWithStringManifest`.
override def toBinary(o: AnyRef): Array[Byte] = {
val buf = ByteBuffer.allocate(256) // in production code, aquire this from a BufferPool
// in production code, aquire this from a BufferPool
val buf = ByteBuffer.allocate(256)
toBinary(o, buf)
buf.flip()
@ -32,7 +33,7 @@ class ByteBufferSerializerDocSpec {
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef =
fromBinary(ByteBuffer.wrap(bytes), manifest)
// Actual implementation in the ByteBuffer versions of to/fromBinary:
// Actual implementation in the ByteBuffer versions of to/fromBinary:
override def toBinary(o: AnyRef, buf: ByteBuffer): Unit = ??? // implement actual logic here
override def fromBinary(buf: ByteBuffer, manifest: String): AnyRef = ??? // implement actual logic here
}

View file

@ -42,6 +42,13 @@ class RemoteDeploymentDocSpec extends AkkaSpec("""
expectMsgType[ActorRef].path.address should be(address)
}
def makeAddress(): Unit = {
//#make-address-artery
val one = AddressFromURIString("akka://sys@host:1234")
val two = Address("akka", "sys", "host", 1234) // this gives the same
//#make-address-artery
}
"demonstrate address extractor" in {
//#make-address
val one = AddressFromURIString("akka.tcp://sys@host:1234")

View file

@ -53,7 +53,7 @@ akka.actor.deployment {
}
}
#//#config-random-pool
#//#config-random-group
akka.actor.deployment {
/parent/router7 {
@ -71,7 +71,7 @@ akka.actor.deployment {
}
}
#//#config-balancing-pool
#//#config-balancing-pool2
akka.actor.deployment {
/parent/router9b {
@ -113,7 +113,7 @@ akka.actor.deployment {
}
}
#//#config-balancing-pool4
#//#config-smallest-mailbox-pool
akka.actor.deployment {
/parent/router11 {
@ -122,7 +122,7 @@ akka.actor.deployment {
}
}
#//#config-smallest-mailbox-pool
#//#config-broadcast-pool
akka.actor.deployment {
/parent/router13 {
@ -131,7 +131,7 @@ akka.actor.deployment {
}
}
#//#config-broadcast-pool
#//#config-broadcast-group
akka.actor.deployment {
/parent/router15 {
@ -150,7 +150,7 @@ akka.actor.deployment {
}
}
#//#config-scatter-gather-pool
#//#config-scatter-gather-group
akka.actor.deployment {
/parent/router19 {
@ -171,7 +171,7 @@ akka.actor.deployment {
}
}
#//#config-tail-chopping-pool
#//#config-tail-chopping-group
akka.actor.deployment {
/parent/router23 {
@ -182,7 +182,7 @@ akka.actor.deployment {
}
}
#//#config-tail-chopping-group
#//#config-consistent-hashing-pool
akka.actor.deployment {
/parent/router25 {
@ -192,7 +192,7 @@ akka.actor.deployment {
}
}
#//#config-consistent-hashing-pool
#//#config-consistent-hashing-group
akka.actor.deployment {
/parent/router27 {
@ -208,23 +208,45 @@ akka.actor.deployment {
/parent/remotePool {
router = round-robin-pool
nr-of-instances = 10
target.nodes = ["akka.tcp://app@10.0.0.2:2552", "akka://app@10.0.0.3:2552"]
target.nodes = ["akka.tcp://app@10.0.0.2:2552", "akka.tcp://app@10.0.0.3:2552"]
}
}
#//#config-remote-round-robin-pool
#//#config-remote-round-robin-pool-artery
akka.actor.deployment {
/parent/remotePool {
router = round-robin-pool
nr-of-instances = 10
target.nodes = ["tcp://app@10.0.0.2:2552", "akka://app@10.0.0.3:2552"]
}
}
#//#config-remote-round-robin-pool-artery
#//#config-remote-round-robin-group
akka.actor.deployment {
/parent/remoteGroup {
router = round-robin-group
routees.paths = [
"akka.tcp://app@10.0.0.1:2552/user/workers/w1",
"akka.tcp://app@10.0.0.1:2552/user/workers/w1",
"akka.tcp://app@10.0.0.2:2552/user/workers/w1",
"akka.tcp://app@10.0.0.3:2552/user/workers/w1"]
}
}
#//#config-remote-round-robin-group
#//#config-remote-round-robin-group-artery
akka.actor.deployment {
/parent/remoteGroup2 {
router = round-robin-group
routees.paths = [
"akka://app@10.0.0.1:2552/user/workers/w1",
"akka://app@10.0.0.2:2552/user/workers/w1",
"akka://app@10.0.0.3:2552/user/workers/w1"]
}
}
#//#config-remote-round-robin-group-artery
#//#config-resize-pool
akka.actor.deployment {
/parent/router29 {
@ -263,7 +285,7 @@ akka.actor.deployment {
}
}
#//#config-pool-dispatcher
router-dispatcher {}
"""
@ -337,7 +359,7 @@ router-dispatcher {}
//#round-robin-group-2
val router4: ActorRef =
context.actorOf(RoundRobinGroup(paths).props(), "router4")
//#round-robin-group-2
//#round-robin-group-2
//#random-pool-1
val router5: ActorRef =
@ -475,7 +497,7 @@ router-dispatcher {}
//#consistent-hashing-group-2
val router28: ActorRef =
context.actorOf(ConsistentHashingGroup(paths).props(), "router28")
//#consistent-hashing-group-2
//#consistent-hashing-group-2
//#resize-pool-1
val router29: ActorRef =
@ -488,7 +510,7 @@ router-dispatcher {}
context.actorOf(
RoundRobinPool(5, Some(resizer)).props(Props[Worker]),
"router30")
//#resize-pool-2
//#resize-pool-2
//#optimal-size-exploring-resize-pool
val router31: ActorRef =
@ -524,7 +546,7 @@ class RouterDocSpec extends AkkaSpec(RouterDocSpec.config) with ImplicitSender {
//#dispatchers
val router: ActorRef = system.actorOf(
// head router actor will run on "router-dispatcher" dispatcher
// Worker routees will run on "pool-dispatcher" dispatcher
// Worker routees will run on "pool-dispatcher" dispatcher
RandomPool(5, routerDispatcher = "router-dispatcher").props(Props[Worker]),
name = "poolWithDispatcher")
//#dispatchers
@ -588,4 +610,17 @@ class RouterDocSpec extends AkkaSpec(RouterDocSpec.config) with ImplicitSender {
RemoteRouterConfig(RoundRobinPool(5), addresses).props(Props[Echo]))
//#remoteRoutees
}
// only compile test
def demonstrateRemoteDeployWithArtery(): Unit = {
//#remoteRoutees-artery
import akka.actor.{ Address, AddressFromURIString }
import akka.remote.routing.RemoteRouterConfig
val addresses = Seq(
Address("akka", "remotesys", "otherhost", 1234),
AddressFromURIString("akka://othersys@anotherhost:1234"))
val routerRemote = system.actorOf(
RemoteRouterConfig(RoundRobinPool(5), addresses).props(Props[Echo]))
//#remoteRoutees-artery
}
}