Hi,

I didn't realize that maps underlying implementation is using via. Should 
have definitely dug into the code more :)

Thanks, it cleared that issue for me.


On Monday, September 5, 2016 at 10:35:10 AM UTC+3, drewhk wrote:
>
> Hi Ori,
>
> The reason is if you have longer, reusable chains of computations then you 
> can factor them out into a Flow. For example if you have a more complex 
> chain handling some deserialization and domain object mapping then you can 
> express it once and then just include it multiple times into other streams. 
> For a simple map this is an overkill of course (btw .map() is converted to 
> a .via() without you seeing it ;) )
>
> -Endre
>
> On Mon, Sep 5, 2016 at 9:30 AM, Ori Popowski <ori...@gmail.com 
> <javascript:>> wrote:
>
>> Hi,
>>
>> It may seem like a trivial question, but I'm a bit confused about use 
>> cases of Source.map vs. Source.via(flow).
>>
>> For example, these two flows produce the exact same output:
>>
>>     val flow1 = Source(1 to 10).map(_ * 2).to(Sink.foreach(println))
>>     val flow2 = Source(1 to 10).via(Flow[Int].map(_ * 2)).to(Sink.foreach
>> (println))
>>
>> so why would anyone express this functionality with flow2?
>>
>> Also, in the example given in this 
>> <https://softwaremill.com/replacing-akka-actors-with-akka-streams/> blog 
>> post, the first way (not using Flows) is used exclusively.
>>
>> Thanks.
>>
>> -- 
>> >>>>>>>>>> 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 <javascript:>.
>> To post to this group, send email to akka...@googlegroups.com 
>> <javascript:>.
>> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to