Add completion timeout example (#29673)
* Adding example for completionTimeout * Adding header to file * Modifying example * Modifying duration * Modifying syntax for duration
This commit is contained in:
parent
289f665445
commit
94d62f34c1
3 changed files with 44 additions and 0 deletions
|
|
@ -4,9 +4,11 @@
|
|||
|
||||
package jdocs.stream.operators;
|
||||
|
||||
import akka.Done;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.japi.pf.PFBuilder;
|
||||
import akka.stream.Materializer;
|
||||
import akka.stream.javadsl.Flow;
|
||||
|
||||
import akka.NotUsed;
|
||||
|
|
@ -475,6 +477,14 @@ class SourceOrFlow {
|
|||
// #watch
|
||||
}
|
||||
|
||||
static CompletionStage<Done> completionTimeoutExample() {
|
||||
// #completionTimeout
|
||||
Source<Integer, NotUsed> source = Source.range(1, 100000).map(number -> number * number);
|
||||
CompletionStage<Done> result = source.completionTimeout(Duration.ofMillis(10)).run(system);
|
||||
return result;
|
||||
// #completionTimeout
|
||||
}
|
||||
|
||||
private ActorRef someActor() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue