=doc Fix wrong scala/java snippet directives #23513

Issue: #23513
Fix inline snippet in stream-io
Fix wrong rendering on other pages
This commit is contained in:
Josep Prat 2017-08-11 19:23:11 +02:00
parent c1f247212f
commit 5216c8b403
5 changed files with 11 additions and 16 deletions

View file

@ -254,7 +254,9 @@ loggers, which are based upon the originating objects class name as log
category. The override of `getClazz` is only included for demonstration category. The override of `getClazz` is only included for demonstration
purposes as it contains exactly the default behavior. purposes as it contains exactly the default behavior.
@@@ note @@@
@@@ note { .group-scala }
You may also create the string representation up front and pass that in as You may also create the string representation up front and pass that in as
the log source, but be aware that then the `Class[_]` which will be the log source, but be aware that then the `Class[_]` which will be
@ -267,7 +269,6 @@ might want to do this also in case you implement your own logging adapter.
@@@ @@@
@@@
### Turn Off Logging ### Turn Off Logging

View file

@ -254,7 +254,8 @@ but is not restricted to that—it could also mean opening files or socket conne
Materialization is triggered at so called "terminal operations". Most notably this includes the various forms of the `run()` Materialization is triggered at so called "terminal operations". Most notably this includes the various forms of the `run()`
and `runWith()` methods defined on `Source` and `Flow` elements as well as a small number of special syntactic sugars for running with and `runWith()` methods defined on `Source` and `Flow` elements as well as a small number of special syntactic sugars for running with
well-known sinks, such as @scala[`runForeach(el => ...)`] @java[`runForeach(el -> ...)`] (being an alias to @scala[`runWith(Sink.foreach(el => ...))`] @java[`runWith(Sink.foreach(el -> ...))`]. well-known sinks, such as @scala[`runForeach(el => ...)`]@java[`runForeach(el -> ...)`]
(being an alias to @scala[`runWith(Sink.foreach(el => ...))`]@java[`runWith(Sink.foreach(el -> ...))`]).
Materialization is currently performed synchronously on the materializing thread. Materialization is currently performed synchronously on the materializing thread.
The actual stream processing is handled by actors started up during the streams materialization, The actual stream processing is handled by actors started up during the streams materialization,

View file

@ -23,7 +23,7 @@ Java
Next, we simply handle *each* incoming connection using a `Flow` which will be used as the processing stage Next, we simply handle *each* incoming connection using a `Flow` which will be used as the processing stage
to handle and emit `ByteString` s from and to the TCP Socket. Since one `ByteString` does not have to necessarily to handle and emit `ByteString` s from and to the TCP Socket. Since one `ByteString` does not have to necessarily
correspond to exactly one line of text (the client might be sending the line in chunks) we use the @scala[`Framing.delimiter`]@java[`delimiter`] correspond to exactly one line of text (the client might be sending the line in chunks) we use the @scala[`Framing.delimiter`]@java[`delimiter`]
helper Flow @scala[]@java[from `akka.stream.javadsl.Framing`] to chunk the inputs up into actual lines of text. The last boolean helper Flow @java[from `akka.stream.javadsl.Framing`] to chunk the inputs up into actual lines of text. The last boolean
argument indicates that we require an explicit line ending even for the last message before the connection is closed. argument indicates that we require an explicit line ending even for the last message before the connection is closed.
In this example we simply add exclamation marks to each incoming text message and push it through the flow: In this example we simply add exclamation marks to each incoming text message and push it through the flow:
@ -45,17 +45,10 @@ It is also possible to shut down the server's socket by cancelling the `Incoming
We can then test the TCP server by sending data to the TCP Socket using `netcat`: We can then test the TCP server by sending data to the TCP Socket using `netcat`:
@scala[
``` ```
$ echo -n "Hello World" | netcat 127.0.0.1 8888 $ echo -n "Hello World" | netcat 127.0.0.1 8888
Hello World!!! Hello World!!!
``` ```
]@java[
```
$ echo -n "Hello World" | netcat 127.0.0.1 8889
Hello World!!!
```
]
### Connecting: REPL Client ### Connecting: REPL Client

View file

@ -85,7 +85,7 @@ There are other ways to create a materializer, e.g. from an
thing that makes streams run—you dont need to worry about any of the details thing that makes streams run—you dont need to worry about any of the details
just now apart from that you need one for calling any of the `run` methods on just now apart from that you need one for calling any of the `run` methods on
a `Source`. @scala[The materializer is picked up implicitly if it is omitted a `Source`. @scala[The materializer is picked up implicitly if it is omitted
from the `run` method call arguments, which we will do in the following.]@java[] from the `run` method call arguments, which we will do in the following.]
The nice thing about Akka Streams is that the `Source` is just a The nice thing about Akka Streams is that the `Source` is just a
description of what you want to run, and like an architects blueprint it can description of what you want to run, and like an architects blueprint it can
@ -271,7 +271,7 @@ Java
Finally in order to @ref:[materialize](stream-flows-and-basics.md#stream-materialization) and run the stream computation we need to attach Finally in order to @ref:[materialize](stream-flows-and-basics.md#stream-materialization) and run the stream computation we need to attach
the Flow to a @scala[`Sink`]@java[`Sink<T, M>`] that will get the Flow running. The simplest way to do this is to call the Flow to a @scala[`Sink`]@java[`Sink<T, M>`] that will get the Flow running. The simplest way to do this is to call
`runWith(sink)` on a @scala[`Source`]@java[`Source<Out, M>`]. For convenience a number of common Sinks are predefined and collected as @scala[]@java[static] methods on `runWith(sink)` on a @scala[`Source`]@java[`Source<Out, M>`]. For convenience a number of common Sinks are predefined and collected as @java[static] methods on
the @scala[`Sink` companion object]@java[`Sink class`]. the @scala[`Sink` companion object]@java[`Sink class`].
For now let's simply print each author: For now let's simply print each author:
@ -421,7 +421,7 @@ has also a type parameter of @scala[`Future[Int]`]@java[`CompletionStage<Integer
This step does *not* yet materialize the This step does *not* yet materialize the
processing pipeline, it merely prepares the description of the Flow, which is now connected to a Sink, and therefore can processing pipeline, it merely prepares the description of the Flow, which is now connected to a Sink, and therefore can
be `run()`, as indicated by its type: @scala[`RunnableGraph[Future[Int]]`]@java[`RunnableGraph<CompletionStage<Integer>>`]. Next we call `run()` which uses the @scala[implicit]@java[] `ActorMaterializer` be `run()`, as indicated by its type: @scala[`RunnableGraph[Future[Int]]`]@java[`RunnableGraph<CompletionStage<Integer>>`]. Next we call `run()` which uses the @scala[implicit] `ActorMaterializer`
to materialize and run the Flow. The value returned by calling `run()` on a @scala[`RunnableGraph[T]`]@java[`RunnableGraph<T>`] is of type `T`. to materialize and run the Flow. The value returned by calling `run()` on a @scala[`RunnableGraph[T]`]@java[`RunnableGraph<T>`] is of type `T`.
In our case this type is @scala[`Future[Int]`]@java[`CompletionStage<Integer>`] which, when completed, will contain the total length of our `tweets` stream. In our case this type is @scala[`Future[Int]`]@java[`CompletionStage<Integer>`] which, when completed, will contain the total length of our `tweets` stream.
In case of the stream failing, this future would complete with a Failure. In case of the stream failing, this future would complete with a Failure.

View file

@ -64,7 +64,7 @@ public class StreamTcpDocTest extends AbstractJavaTest {
//#echo-server-simple-bind //#echo-server-simple-bind
// IncomingConnection and ServerBinding imported from Tcp // IncomingConnection and ServerBinding imported from Tcp
final Source<IncomingConnection, CompletionStage<ServerBinding>> connections = final Source<IncomingConnection, CompletionStage<ServerBinding>> connections =
Tcp.get(system).bind("127.0.0.1", 8889); Tcp.get(system).bind("127.0.0.1", 8888);
//#echo-server-simple-bind //#echo-server-simple-bind
} }
{ {
@ -133,7 +133,7 @@ public class StreamTcpDocTest extends AbstractJavaTest {
{ {
//#repl-client //#repl-client
final Flow<ByteString, ByteString, CompletionStage<OutgoingConnection>> connection = final Flow<ByteString, ByteString, CompletionStage<OutgoingConnection>> connection =
Tcp.get(system).outgoingConnection("127.0.0.1", 8889); Tcp.get(system).outgoingConnection("127.0.0.1", 8888);
//#repl-client //#repl-client
} }