Hello everyone,

Is there a canonical way of accessing the dispatcher/ExecutionContext used 
for a mapAsync stage? I would like to use the monadic combinators on a 
future within my mapAsync stage, and these require an implicit 
ExecutionContext.

Contrived example:
```
def myFlow = Flow[Int].mapAsync(1) { n =>
  Future(n).map(_.toString) // requires an implicit EC
}
```

I'm worried about this because 

I've come up with two solutions:
1. Simply pass an implicit ExecutionContext to the factory function, which 
is OK but can be somewhat hard to keep track of
2. Do the following:

```
def myFlow = Flow[Int].flatMapConcat { n =>
  Source.single(n)
    .mapAsync(1)(Future(_))
    .map(_.toString)
}
```
    ... which is OK too, but seems boilerplate-y.

Any thoughts? Some of my stages are doing blocking I/O (using Kafka), so 
I'd like to make sure they stay on their respective dispatchers.

-- 
>>>>>>>>>>      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