!str #19732 Concise and consistent way to mark async boundaries
This commit is contained in:
parent
d154fad4e9
commit
4e49d75ad8
25 changed files with 125 additions and 194 deletions
|
|
@ -287,8 +287,7 @@ public class FlowDocTest {
|
|||
|
||||
//#flow-async
|
||||
Source.range(1, 3)
|
||||
.map(x -> x + 1)
|
||||
.withAttributes(Attributes.asyncBoundary())
|
||||
.map(x -> x + 1).async()
|
||||
.map(x -> x * 2)
|
||||
.to(Sink.ignore());
|
||||
//#flow-async
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package docs.stream;
|
|||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import akka.NotUsed;
|
||||
import akka.japi.Pair;
|
||||
import akka.stream.javadsl.*;
|
||||
//#asPublisher-import
|
||||
|
|
@ -27,6 +28,11 @@ public class MigrationsJava {
|
|||
Sink.asPublisher(WITH_FANOUT); // instead of Sink.asPublisher(true)
|
||||
Sink.asPublisher(WITHOUT_FANOUT); // instead of Sink.asPublisher(false)
|
||||
//#asPublisher
|
||||
|
||||
//#async
|
||||
Flow<Integer, Integer, NotUsed> flow = Flow.of(Integer.class).map(n -> n + 1);
|
||||
Source.range(1, 10).via(flow.async());
|
||||
//#async
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue