!str split Framing into javadsl and scaladsl
This commit is contained in:
parent
5d3a8256c1
commit
c25e0abab6
14 changed files with 178 additions and 23 deletions
|
|
@ -7,7 +7,7 @@ import java.util.concurrent.CompletionStage;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import akka.NotUsed;
|
||||
import akka.stream.io.Framing;
|
||||
import akka.stream.javadsl.Framing;
|
||||
import docs.AbstractJavaTest;
|
||||
import docs.stream.SilenceSystemOut;
|
||||
import java.net.InetSocketAddress;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import akka.NotUsed;
|
|||
import akka.actor.ActorSystem;
|
||||
import akka.stream.ActorMaterializer;
|
||||
import akka.stream.Materializer;
|
||||
import akka.stream.io.Framing;
|
||||
import akka.stream.javadsl.Framing;
|
||||
import akka.stream.javadsl.Sink;
|
||||
import akka.stream.javadsl.Source;
|
||||
import akka.testkit.JavaTestKit;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ which will emit an :class:`IncomingConnection` element for each new connection t
|
|||
Next, we simply handle *each* incoming connection using a :class:`Flow` which will be used as the processing stage
|
||||
to handle and emit ByteStrings from and to the TCP Socket. Since one :class:`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 ``delimiter``
|
||||
helper Flow from ``akka.stream.io.Framing`` to chunk the inputs up into actual lines of text. The last boolean
|
||||
helper Flow 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.
|
||||
In this example we simply add exclamation marks to each incoming text message and push it through the flow:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue