Enable fatal errors for docs (#29570)
This commit is contained in:
parent
e0ceb71ccd
commit
ca59d8149c
55 changed files with 268 additions and 223 deletions
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
package docs.stream.operators
|
||||
|
||||
import akka.Done
|
||||
import akka.actor.ActorSystem
|
||||
import akka.testkit.TestProbe
|
||||
|
||||
|
|
@ -12,7 +11,7 @@ object SourceOperators {
|
|||
|
||||
implicit val system: ActorSystem = ???
|
||||
|
||||
def fromFuture = {
|
||||
def fromFuture(): Unit = {
|
||||
//#sourceFromFuture
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
|
|
@ -35,7 +34,6 @@ object SourceOperators {
|
|||
import akka.stream.OverflowStrategy
|
||||
import akka.stream.CompletionStrategy
|
||||
import akka.stream.scaladsl._
|
||||
import scala.util.Failure
|
||||
|
||||
val source: Source[Any, ActorRef] = Source.actorRef(
|
||||
completionMatcher = {
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ class StreamConvertersToJava extends AkkaSpec with Futures {
|
|||
"demonstrate conversion from Java8 streams" in {
|
||||
//#fromJavaStream
|
||||
def factory(): IntStream = IntStream.rangeClosed(0, 9)
|
||||
val source: Source[Int, NotUsed] = StreamConverters.fromJavaStream(factory).map(_.intValue())
|
||||
val source: Source[Int, NotUsed] = StreamConverters.fromJavaStream(() => factory()).map(_.intValue())
|
||||
val sink: Sink[Int, Future[immutable.Seq[Int]]] = Sink.seq[Int]
|
||||
|
||||
val futureInts: Future[immutable.Seq[Int]] = source.toMat(sink)(Keep.right).run
|
||||
val futureInts: Future[immutable.Seq[Int]] = source.toMat(sink)(Keep.right).run()
|
||||
|
||||
//#fromJavaStream
|
||||
whenReady(futureInts) { ints =>
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@ import akka.stream.scaladsl.Source
|
|||
import akka.stream.scaladsl.Tcp
|
||||
import akka.stream.testkit.TestPublisher
|
||||
import akka.stream.testkit.TestSubscriber
|
||||
import akka.stream.testkit.Utils.TE
|
||||
import akka.stream.testkit.scaladsl.TestSource
|
||||
import akka.stream.testkit.scaladsl.TestSink
|
||||
import akka.util.ByteString
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
|
@ -63,7 +60,7 @@ object FromSinkAndSource {
|
|||
def testing(): Unit = {
|
||||
def myApiThatTakesAFlow[In, Out](flow: Flow[In, Out, NotUsed]): Unit = ???
|
||||
// #testing
|
||||
val inProbe = TestSubscriber.probe[String]
|
||||
val inProbe = TestSubscriber.probe[String]()
|
||||
val outProbe = TestPublisher.probe[String]()
|
||||
val testFlow = Flow.fromSinkAndSource(Sink.fromSubscriber(inProbe), Source.fromPublisher(outProbe))
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ object Restart extends App {
|
|||
|
||||
}
|
||||
|
||||
def onRestartWithBackoffInnerComplete() {
|
||||
def onRestartWithBackoffInnerComplete() = {
|
||||
|
||||
//#restart-failure-inner-complete
|
||||
val finiteSource = Source.tick(1.second, 1.second, "tick").take(3)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ object Tick {
|
|||
case class Response(text: String)
|
||||
}
|
||||
|
||||
def simple() {
|
||||
def simple() = {
|
||||
// #simple
|
||||
Source
|
||||
.tick(
|
||||
|
|
@ -39,7 +39,7 @@ object Tick {
|
|||
// #simple
|
||||
}
|
||||
|
||||
def pollSomething() {
|
||||
def pollSomething() = {
|
||||
// #poll-actor
|
||||
val periodicActorResponse: Source[String, Cancellable] = Source
|
||||
.tick(1.second, 1.second, "tick")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
package docs.stream.operators.source
|
||||
|
||||
import akka.NotUsed
|
||||
import akka.actor.typed.ActorSystem
|
||||
import akka.stream.scaladsl.Source
|
||||
|
||||
|
|
@ -48,7 +47,7 @@ object Zip {
|
|||
// #zipWithN-simple
|
||||
}
|
||||
|
||||
def zipAll() {
|
||||
def zipAll() = {
|
||||
// #zipAll-simple
|
||||
val numbers = Source(1 :: 2 :: 3 :: 4 :: Nil)
|
||||
val letters = Source("a" :: "b" :: "c" :: Nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue