Thanks for the reply, Patrik! In my use case Processor should send and 
receive multiple messages from other parts of the system and I thought that 
using single custom processor in a Flow is a more optimal approach then 
spawning multiple intermediate ask actors from mapAsync(I know  that 
premature optimization is bad =) ). Howewer I realized that my current 
implementation feels too hacky(AFAIK there is no standart way to access 
materializer instance to create actor as it's child so I have to use 
ActorSystem etc.) so I'll stick with multiple ask inside mapAsync until 
it'll become a problem.

On Friday, March 27, 2015 at 11:56:59 AM UTC+3, Patrik Nordwall wrote:
>
> Perhaps you can use mapAsync and ask the actor, instead of 
> using ActorSubscriber, ActorPublisher?
>
> Later, there will be an AsyncStage that might be useful.
>
> /Patrik
>
> On Mon, Mar 23, 2015 at 6:56 PM, <[email protected] <javascript:>> 
> wrote:
>
>> Hi! I would like to use custom actor which implements ActorPublisher and 
>> ActorSubscriber as a stage in Flow and pass it to HTTP 
>> connection.handleWith. However I can't find any references how to achieve 
>> this and currently I'm using something like this: 
>>
>> val createProcessor = (system: ActorSystem) => {
>>   val processorRef = system.actorOf(Props[ProcessorActor])
>>   val sub = Sink (ActorSubscriber[HttpRequest] (processorRef) )
>>   val pub = Source (ActorPublisher[HttpResponse] (processorRef) )
>>   Flow () (b => (b.add(sub), b.add(pub)))
>> }
>>
>> and call this function for each incoming connection.
>>
>> Are there any better alternatives or this approach is ok?
>>
>> Thanks in advance!
>>
>> -- 
>> >>>>>>>>>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
>  

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

Reply via email to