Hi Giovanni, you approach with mapAsync and asking your actor for the next item seems fine.
I think it is a bug that custom dispatcher is ignored when creating a source from props. Here is the insides <https://github.com/akka/akka/blob/38d8f265dad3909f3d597f4c3c9da65a7bf576d2/akka-stream/src/main/scala/akka/stream/impl/Sources.scala#L166> of PropsSource which asks materializer to create an actor from the props, and here is the corresponding <https://github.com/akka/akka/blob/38d8f265dad3909f3d597f4c3c9da65a7bf576d2/akka-stream/src/main/scala/akka/stream/impl/ActorFlowMaterializerImpl.scala#L157> materializer line that uses dispatcher from settings and not a one from props. Could you register an issue for this on the Akka github page? On Thu, Feb 19, 2015 at 2:28 AM, Giovanni Alberto Caporaletti < [email protected]> wrote: > I forgot that the documentation said something about this (remembering it > like five seconds after asking the question) . I went to look it up and I > found this: > > Stream transformations and side effects involving external non-stream > based services can be performed withmapAsync or mapAsyncUnordered. > > I need to represent the blocking service as a future and use mapAsync with > a custom dispatcher then. > > Since I have a stateful actor that produces items one after the other as > soon as they're requested (my current ActorProducer), I guess I need to > model it as a normal actor so that I can ask it "giveMeNextItem" and use > the resulting future in a mapAsync. Is that correct? > > > Sorry for thinking out loud but the model is pretty different from rx > schedulers and I'm trying to "grok" it as well as I can :) > > Cheers > G > > > On Wednesday, 18 February 2015 23:54:07 UTC, Giovanni Alberto Caporaletti > wrote: >> >> Hi again, >> I have another question. >> Let's say that I write a blocking ActorProducer (could be anything, >> external service, database, whatever), and I want it to use a specific >> dispatcher explicitly configured to handle blocking operations. Suppose I >> have an MyActor.props() method that returns something like >> Props[MyActor].withDispatcher("my-dispatcher"). >> >> Now, when I create a source with Source(MyActor.props) and materialize it >> in a flow, every actor involved in the flow uses the dispatcher configured >> in the ActorFlowMaterializerSettings (or the default dispatcher if nothing >> is configured). In other words, the .withDispatcher("...") in the props is >> completely ignored. >> >> How do I configure an ActorProducer to be on a differentdispatcher? If >> this is the wrong way of doing it, how should I handle blocking >> ActorProducers? >> >> Thank you >> >> G >> > -- > >>>>>>>>>> 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 http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Martynas Mickevičius Typesafe <http://typesafe.com/> – Reactive <http://www.reactivemanifesto.org/> Apps on the JVM -- >>>>>>>>>> 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
