A flow is not something you can run - it's defined as "one open input, one open output". What the method fromSinkAndSource builds is like a flow made from two discrete parts. Imagine that it's input will be drained to the given sink, and it's output IS the source you gave it.
If you just want to run the code you provided there you just compose them, without any fromSinkAndSource which is a very specific advanced thing :-) So just Source.range(1, 100).map(v -> new X()).to(Sink.foreach(v -> System.out.println(v))).run() I recommend you start with reading the docs from the beginning about Akka Streams, they explain how they work :) Happy hakking. -- Konrad `ktoso` Malawski Akka <http://akka.io> @ Lightbend <http://lightbend.com> On 3 May 2017 at 21:33:06, 'Michal Borowiecki' via Akka User List ( [email protected]) wrote: Hi Igmar, You can do a map on the source and pass the new returned Source as the second parameter to Flow.fromSinkAndSource instead of the original source. Something like this (untested): final Source<X, NotUsed> source = Source.range(1, 100).map(v -> new X()); final Sink<X, CompletionStage<Done>> sink = Sink.foreach(v -> System.out.println(v)); final Flow<X, Integer, NotUsed> flow = Flow.fromSinkAndSource(sink, source); Hope that helps, MichaĆ On 03/05/17 10:42, Igmar Palsenberg wrote: Hi, I'm starting to learn the basics of Akka Streams, and I have this : final Source<Integer, NotUsed> source = Source.range(1, 100); final Sink<X, CompletionStage<Done>> sink = Sink.foreach(v -> System.out.println(v)); final Flow<X, Integer, NotUsed> flow = Flow.fromSinkAndSource(sink, source); What I'v read from the docs : Flow A processing stage which has *exactly one input and output*, which connects its up- and downstreams by transforming the data elements flowing through it. If I understand correctly, I could transform an Integer to an X. A map on flow doesn't work, since that requires an Integer to be returned. I tried : Flow<X, X, NotUsed> x = flow.map(v -> return new X() ); but then I can't materialize the flow using runWith, since it requires both a sink and a source (why ?? Since fromSinkAndSource already provided that). Can someone shed a light on this ? Regards, Igmar -- >>>>>>>>>> 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. -- <http://www.openbet.com/> Michal Borowiecki Senior Software Engineer L4 T: +44 208 742 1600 +44 203 249 8448 E: [email protected] W: www.openbet.com OpenBet Ltd Chiswick Park Building 9 566 Chiswick High Rd London W4 5XT UK <https://www.openbet.com/email_promo> This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [email protected] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by OpenBet for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. OpenBet Ltd. Registered Office: Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT, United Kingdom. A company registered in England and Wales. Registered no. 3134634. VAT no. GB927523612 -- >>>>>>>>>> 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. -- >>>>>>>>>> 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.
part8.8352F84A.FD7772B3@openbet
Description: Binary data
part10.348033CA.7DA4B093@openbet
Description: Binary data
part15.AE5CD431.AC560E07@openbet
Description: Binary data
