But it can be improved; instead of creating and destroying actors per 
Future why not just create a pool of actors (or workers if you will),
the recommended amount of concurrent actors you want is usually a factor of 
CPUs, say CPUs x N where N in [1..4], of course,
and if these actors use legacy code and have a chance to block create them 
on a separate dispatcher.

Once you create these actors put them in a RoundRobin router so that they 
alternate (who will receive the next future) and send the Future to your 
router.
You can do all that programmatically, these actors can be created with a 
Creator if you need to pass constructor parameter to wire them up with 
other things,
I will post later sample code of a router with workers if you haven't 
figured it out, let me know if you do or don't in a couple of hours.

HTH,

Guido.

On Wednesday, June 29, 2016 at 3:25:23 PM UTC+1, kraythe wrote:
>
> Thanks for the reply Mark. I understand where you are comming from but the 
> actual implementation in proprietary code is quit a bit more complex. 
> Future a response drives data needed for future b and c requests. The 
> actual code with completable futures is significantly more complex. I would 
> rather be able to do an ask and collect three responses before returning 
> from the ask but I don't think there is a way to do that without encoding 
> asks into the actor itself which seems worse than this. Currently the 
> implementation works. I did add a receive timeout though. If there is a 
> better way or something wrong with this way then I would change it

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to