=doc fixes for Akka Streams quick start guide

This commit is contained in:
Heiko Seeberger 2014-12-25 11:33:42 +01:00
parent ea389e16ed
commit db44791a58
5 changed files with 13 additions and 17 deletions

View file

@ -67,7 +67,6 @@ class FlowStagesSpec extends AkkaSpec {
else ctx.finish()
}
override def onUpstreamFinish(ctx: Context[A]): TerminationDirective =
ctx.absorbTermination()

View file

@ -127,7 +127,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
//#tweet-authors
val authors: Source[Author] =
tweets
.filter(_.hashtags.contains(Akka))
.filter(_.hashtags.contains(akka))
.map(_.author)
//#tweet-authors
@ -166,7 +166,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
//#external-service-mapAsyncUnordered
val authors: Source[Author] =
tweets.filter(_.hashtags.contains(Akka)).map(_.author)
tweets.filter(_.hashtags.contains(akka)).map(_.author)
val emailAddresses: Source[String] =
authors
@ -199,7 +199,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val addressSystem = new AddressSystem
val smsServer = new SmsServer(probe.ref)
val authors = tweets.filter(_.hashtags.contains(Akka)).map(_.author)
val authors = tweets.filter(_.hashtags.contains(akka)).map(_.author)
val phoneNumbers =
authors.mapAsync(author => addressSystem.lookupPhoneNumber(author.handle))
@ -236,7 +236,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val addressSystem = new AddressSystem
val smsServer = new SmsServer(probe.ref)
val authors = tweets.filter(_.hashtags.contains(Akka)).map(_.author)
val authors = tweets.filter(_.hashtags.contains(akka)).map(_.author)
val phoneNumbers =
authors.mapAsync(author => addressSystem.lookupPhoneNumber(author.handle))
@ -270,9 +270,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val database = system.actorOf(Props(classOf[DatabaseService], probe.ref), "db")
//#save-tweets
import akka.pattern.ask
val akkaTweets: Source[Tweet] = tweets.filter(_.hashtags.contains(Akka))
val akkaTweets: Source[Tweet] = tweets.filter(_.hashtags.contains(akka))
implicit val timeout = Timeout(3.seconds)
val saveTweets: RunnableFlow =

View file

@ -23,7 +23,7 @@ class ReactiveStreamsDocSpec extends AkkaSpec {
trait Fixture {
//#authors
val authors = Flow[Tweet]
.filter(_.hashtags.contains(Akka))
.filter(_.hashtags.contains(akka))
.map(_.author)
//#authors

View file

@ -29,8 +29,7 @@ import akka.stream.testkit.AkkaSpec
object TwitterStreamQuickstartDocSpec {
//#model
final case class Author(handle: String)
val AkkaTeam = Author("akkateam")
val Akka = Hashtag("#akka")
val akka = Hashtag("#akka")
final case class Hashtag(name: String)
@ -78,14 +77,14 @@ class TwitterStreamQuickstartDocSpec extends AkkaSpec {
//#authors-filter-map
val authors: Source[Author] =
tweets
.filter(_.hashtags.contains(Akka))
.filter(_.hashtags.contains(akka))
.map(_.author)
//#authors-filter-map
trait Example3 {
//#authors-collect
val authors: Source[Author] =
tweets.collect { case t if t.hashtags.contains(Akka) => t.author }
tweets.collect { case t if t.hashtags.contains(akka) => t.author }
//#authors-collect
}
@ -167,7 +166,7 @@ class TwitterStreamQuickstartDocSpec extends AkkaSpec {
val sum: Future[Int] = map.get(sumSink)
sum.map { c => println(s"Total tweets processed: $c") }
sum.foreach(c => println(s"Total tweets processed: $c"))
//#tweets-fold-count
new AnyRef {
@ -184,7 +183,7 @@ class TwitterStreamQuickstartDocSpec extends AkkaSpec {
val sumSink = Sink.fold[Int, Int](0)(_ + _)
val counterRunnableFlow: RunnableFlow =
tweetsInMinuteFromNow
.filter(_.hashtags contains Akka)
.filter(_.hashtags contains akka)
.map(t => 1)
.to(sumSink)