[akka-streams] How to guarantee parallel execution of Sunflower?

26 views
Skip to first unread message

Alexey Shuksto

unread,
Aug 13, 2017, 6:35:47 AM8/13/17
to Akka User List
Hello there,

Is there a way to guarantee that subflows after '.groupBy(..)' operation would be performed in parallel (I.e. by separate actors) until merged back into Flow?

For example, in code like 'Flow[Int].groupBy(3,_ % 3).map(_.toString).mergeSubstreams()' where should I put something like async barrier?

I've tried it after groupBy and after map, but according to logs it is still executed in the same dispatcher thread.

Scala 2.12.3, Akka 2.5.3.

Patrik Nordwall

unread,
Aug 13, 2017, 8:24:16 AM8/13/17
to akka...@googlegroups.com
It should work with .async after groupBy. It can still be same thread. To see it (different threads) you might have to add a sleep in the map.

/Patrik
--
>>>>>>>>>>      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.

Alexey Shuksto

unread,
Aug 13, 2017, 2:35:18 PM8/13/17
to Akka User List
Thanks, Patrick!

One more question regarding'.async' -- is there any point in adding it to Merge/BroadcastHub stages or their materialized sinks/sources?

Patrik Nordwall

unread,
Aug 13, 2017, 3:40:37 PM8/13/17
to akka...@googlegroups.com
MergeHub, BroadcastHub and PartitionHub always add an asynchronous boundary so you shouldn't use .async with them.

/Patrik

On Sun, Aug 13, 2017 at 8:35 PM, Alexey Shuksto <sei...@gmail.com> wrote:
Thanks, Patrick!

One more question regarding'.async' -- is there any point in adding it to Merge/BroadcastHub stages or their materialized sinks/sources?
--
>>>>>>>>>>      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+unsubscribe@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

Reply all
Reply to author
Forward
0 new messages