Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1365

How to use alsoTo

$
0
0

Hi,

I would expect that the completion stage “b” completes in the example below. But it does not and “a” does. How do i get “b” to complete?

        ActorSystem system = ActorSystem.create();

        Sink<String, CompletionStage<List<String>>> seq = Flow.<String>create().log("second").toMat(Sink.seq(), Keep.right());
        CompletionStage<List<String>> b = seq.preMaterialize(system).first();
        CompletionStage<List<String>> a = Source.from(Arrays.asList("a", "b", "c"))
                .alsoTo(seq)
                .log("first")
                .toMat(Sink.seq(), Keep.right())
                .run(system);

        a.thenAccept(System.out::println);
        b.thenAccept(System.out::println);

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1365

Trending Articles