Docs: Actor source stream operators (#29178)

This commit is contained in:
Enno 2020-06-15 14:11:28 +02:00 committed by GitHub
parent 2c4e114ecd
commit bc68f0d650
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 288 additions and 29 deletions

View file

@ -108,13 +108,15 @@ public class SourceDocExamples {
final ActorSystem system = null;
// #actorRefWithBackpressure
Source<Object, ActorRef> source =
Source.actorRefWithBackpressure(
Source<String, ActorRef> source =
Source.<String>actorRefWithBackpressure(
"ack",
// complete when we send "complete"
o -> {
if (o == "complete") return Optional.of(CompletionStrategy.draining());
else return Optional.empty();
},
// do not fail on any message
o -> Optional.empty());
ActorRef actorRef = source.to(Sink.foreach(System.out::println)).run(system);