diff --git a/akka-docs/src/main/paradox/scala/actors.md b/akka-docs/src/main/paradox/scala/actors.md index 22dcee3cc5..69a0ca8752 100644 --- a/akka-docs/src/main/paradox/scala/actors.md +++ b/akka-docs/src/main/paradox/scala/actors.md @@ -51,6 +51,12 @@ stored within the actor as its “initial behavior”, see [Become/Unbecome](#be further information on changing the behavior of an actor after its construction. + +#### Here is another example that you can edit and run in the browser: + +@@fiddle [ActorDocSpec.scala]($code$/scala/docs/actor/ActorDocSpec.scala) { #fiddle_code height=400px extraParams=theme=light&layout=v75 cssStyle=width:100%; } + + ### Props `Props` is a configuration class to specify options for the creation @@ -78,12 +84,6 @@ for cases when the actor constructor takes value classes as arguments. @@@ -@@@ note { title=DIY } - -@@fiddle [ActorDocSpec.scala]($code$/scala/docs/actor/ActorDocSpec.scala) { #fiddle_code height=400px extraParams=theme=light&layout=v75 cssStyle=width:100%; } - -@@@ - #### Dangerous Variants @@snip [ActorDocSpec.scala]($code$/scala/docs/actor/ActorDocSpec.scala) { #creating-props-deprecated } diff --git a/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md b/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md index 259de5cb00..afcc3d888c 100644 --- a/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md +++ b/akka-docs/src/main/paradox/scala/stream/stream-quickstart.md @@ -82,6 +82,12 @@ called a `Sink`. `IOResult` is a type that IO operations return in Akka Streams in order to tell you how many bytes or elements were consumed and whether the stream terminated normally or exceptionally. + +#### Here is another example that you can edit and run in the browser: + +@@fiddle [TwitterStreamQuickstartDocSpec.scala]($code$/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala) { #fiddle_code height=400px extraParams=theme=light&layout=v75 cssStyle=width:100%; } + + ## Reusable Pieces One of the nice parts of Akka Streams—and something that other stream libraries @@ -241,12 +247,6 @@ whereas `flatMap` would have to operate on streams all the way through. @@@ -@@@ note { title=DIY } - -@@fiddle [TwitterStreamQuickstartDocSpec.scala]($code$/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala) { #fiddle_code height=400px extraParams=theme=light&layout=v75 cssStyle=width:100%; } - -@@@ - ## Broadcasting a stream Now let's say we want to persist all hashtags, as well as all author names from this one live stream. diff --git a/akka-docs/src/test/scala/docs/actor/ActorDocSpec.scala b/akka-docs/src/test/scala/docs/actor/ActorDocSpec.scala index a382b0099e..9ace187ad1 100644 --- a/akka-docs/src/test/scala/docs/actor/ActorDocSpec.scala +++ b/akka-docs/src/test/scala/docs/actor/ActorDocSpec.scala @@ -5,29 +5,21 @@ package docs.actor import jdocs.actor.ImmutableMessage -//#fiddle_code import language.postfixOps -//#fiddle_code -//#fiddle_code //#imports1 import akka.actor.Actor import akka.actor.Props -//#fiddle_code import akka.event.Logging //#imports1 import scala.concurrent.Future -//#fiddle_code import akka.actor.{ ActorRef, ActorSystem, PoisonPill, Terminated, ActorLogging } -//#fiddle_code import org.scalatest.{ BeforeAndAfterAll, WordSpec } import akka.testkit._ import akka.util._ -//#fiddle_code import scala.concurrent.duration._ -//#fiddle_code import scala.concurrent.Await import akka.Done import akka.actor.CoordinatedShutdown @@ -284,6 +276,9 @@ final case class Give(thing: Any) //#receive-orElse //#fiddle_code +import akka.actor.{ ActorSystem, Actor, ActorRef, Props, PoisonPill } +import language.postfixOps +import scala.concurrent.duration._ case object Ping case object Pong @@ -380,7 +375,7 @@ class ActorDocSpec extends AkkaSpec(""" ponger ! Ping } -// $FiddleDependency org.akka-js %%% akkajsactor % 1.2.5.1 + // $FiddleDependency org.akka-js %%% akkajsactor % 1.2.5.1 //#fiddle_code testProbe.expectTerminated(pinger) testProbe.expectTerminated(ponger) diff --git a/akka-docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala b/akka-docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala index 3a21cf30cb..0741bb4eb3 100644 --- a/akka-docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala +++ b/akka-docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala @@ -5,12 +5,10 @@ package docs.stream //#imports -//#fiddle_code import akka.{ Done, NotUsed } import akka.actor.ActorSystem import akka.stream.{ ClosedShape, ActorMaterializer, OverflowStrategy } import akka.stream.scaladsl._ -//#fiddle_code import scala.concurrent.Await import scala.concurrent.Future @@ -20,6 +18,10 @@ import akka.testkit.AkkaSpec object TwitterStreamQuickstartDocSpec { //#fiddle_code + import akka.NotUsed + import akka.actor.ActorSystem + import akka.stream.ActorMaterializer + import akka.stream.scaladsl._ //#model final case class Author(handle: String)