Akka Typed ask() for Akka Streams (#24892)

* +str,typ introduce akka typed ask for akka stream

address feedback and add actor interop stages incl ask to docs

more compile tests and adjusted things

last docs

* document adding stages to docs in CONTRIBUTING

* address review comments

* rebase conflicts
This commit is contained in:
Konrad `ktoso` Malawski 2018-05-07 19:23:30 +09:00 committed by GitHub
parent ae20ecaf99
commit 256f81f97e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 549 additions and 16 deletions

View file

@ -5,6 +5,8 @@
import sbt._
import sbt.Keys._
import scala.util.control.NonFatal
/**
* Generate the "index" pages of stream operators.
*/
@ -32,7 +34,8 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
"Fan-in stages",
// TODO these don't show up as def's yet so don't show up in the index..
// "Fan-out stages",
"Watching status stages"
"Watching status stages",
"Actor interop stages",
)
def categoryId(name: String): String = name.toLowerCase.replace(' ', '-')
@ -106,6 +109,12 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
"FileIO" -> Seq(
"fromFile",
"toFile"
),
"ActorSink" Seq(
"actorRefWithAck"
),
"ActorSource" Seq(
"actorRef"
)
)
@ -140,8 +149,17 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
"akka-stream/src/main/scala/akka/stream/javadsl/StreamConverters.scala",
"akka-stream/src/main/scala/akka/stream/scaladsl/FileIO.scala",
"akka-stream/src/main/scala/akka/stream/javadsl/FileIO.scala",
// akka-stream-typed
"akka-stream-typed/src/main/scala/akka/stream/typed/javadsl/ActorSource.scala",
"akka-stream-typed/src/main/scala/akka/stream/typed/scaladsl/ActorSource.scala",
"akka-stream-typed/src/main/scala/akka/stream/typed/javadsl/ActorFlow.scala",
"akka-stream-typed/src/main/scala/akka/stream/typed/scaladsl/ActorFlow.scala",
"akka-stream-typed/src/main/scala/akka/stream/typed/scaladsl/ActorSink.scala",
"akka-stream-typed/src/main/scala/akka/stream/typed/javadsl/ActorSink.scala",
).flatMap{ f
val element = f.split("/")(7).split("\\.")(0)
val slashesNr = f.count(_ == '/')
val element = f.split("/")(slashesNr).split("\\.")(0)
IO.read(new File(f)).split("\n")
.map(_.trim).filter(_.startsWith("def "))
.map(_.drop(4).takeWhile(c c != '[' && c != '(' && c != ':'))
@ -167,7 +185,7 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
}
.groupBy(_._1)
.mapValues(lines =>
"| |Operator|Description|\n" ++
"| |Operator|Description|\n" ++ // TODO mini images here too
"|--|--|--|\n" ++
lines
.map(_._2)
@ -183,14 +201,17 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
}.mkString("\n\n")
val content =
"# Operators\n\n" + tables + "\n\n@@@ index\n\n" +
"<!-- DO NOT EDIT DIRECTLY: This file is generated by `project/StreamOperatorsIndexGenerator`. See CONTRIBUTING.md for details. -->\n" +
"# Operators\n\n" +
tables +
"\n\n@@@ index\n\n" +
groupedDefs.map { case (_, method, md) => s"* [$method]($md)" }.mkString("\n") + "\n\n@@@\n"
if (!file.exists || IO.read(file) != content) IO.write(file, content)
Seq(file)
}
def getDetails(file: File): (String, String) = {
def getDetails(file: File): (String, String) = try {
val contents = IO.read(file)
val lines = contents.split("\\r?\\n")
require(
@ -208,6 +229,9 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
require(categories.contains(categoryName), s"category $categoryName in $file should be known")
require(categoryLinkId == categoryId(categoryName), s"category id $categoryLinkId in $file")
(description, categoryName)
} catch {
case NonFatal(ex)
throw new RuntimeException(s"Unable to extract details from $file", ex)
}
}