Ok thank you for your answer.
Le mardi 7 mars 2017 08:20:35 UTC+1, Alexandre Delegue a écrit :
>
> Hi,
>
> Executing this code
>
> Source.range(1, 4)
> .mapAsync(1, e -> CompletableFuture.supplyAsync(() -> {
> System.out.println("Num "+e);
> return e;
> }))
> .filter(any -> true)
> .take(1)
> .runWith(Sink.foreach(e -> { System.out.println("End "+e); }), mat);
>
>
> Will print
> Num 1
> End 1
> Num 2
>
> I don't understand why the async call in mapAsync is executed for number 2
> while the stream should be completed.
>
> This work fine
>
> Source.range(1, 4)
> .mapAsync(1, e -> CompletableFuture.supplyAsync(() -> {
> System.out.println("Num "+e);
> return e;
> }))
> .take(1)
> .runWith(Sink.foreach(e -> { System.out.println("End "+e); }), mat);
>
>
> So it seems that the filter method pull next element even if the stream is
> completed.
>
> Any idea? Is there a way to avoid that ?
>
> Thanks,
> Alexandre.
>
>
>
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.