- final Source<Integer, NotUsed> in = Source.from(Arrays.asList(1, 2, 3, 4, 5));
- final Sink<List<String>, CompletionStage<List<String>>> sink = Sink.head();
- final Sink<List<Integer>, CompletionStage<List<Integer>>> sink2 = Sink.head();
- final Flow<Integer, Integer, NotUsed> f1 = Flow.of(Integer.class).map(elem -> elem + 10);
- final Flow<Integer, Integer, NotUsed> f2 = Flow.of(Integer.class).map(elem -> elem + 20);
- final Flow<Integer, String, NotUsed> f3 = Flow.of(Integer.class).map(elem -> elem.toString());
- final Flow<Integer, Integer, NotUsed> f4 = Flow.of(Integer.class).map(elem -> elem + 30);
-
- final RunnableGraph<CompletionStage<List<String>>> result =
- RunnableGraph.<CompletionStage<List<String>>>fromGraph(
- GraphDSL
- .create(
- sink,
- (builder, out) -> {
- final UniformFanOutShape<Integer, Integer> bcast = builder.add(Broadcast.create(2));
- final UniformFanInShape<Integer, Integer> merge = builder.add(Merge.create(2));
-
- final Outlet<Integer> source = builder.add(in).out();
- builder.from(source).via(builder.add(f1))
- .viaFanOut(bcast).via(builder.add(f2)).viaFanIn(merge)
- .via(builder.add(f3.grouped(1000))).to(out);
- builder.from(bcast).via(builder.add(f4)).toFanIn(merge);
- return ClosedShape.getInstance();
- }));
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Patrik Nordwall
Akka Tech Lead
Lightbend - Reactive apps on the JVM
Twitter: @patriknw