Reputation: 3197
I'm working with web service clients, and they are slow on the first call. Instead of always creating a brand new one, I would like to use actors and have say 5 actors to wrap the web service clients. Since web service clients are not thread safe (at least with the library I've used to generate them), this makes perfect sense.
I thought about then having a parent actor which would hand off the work to the five workers, one after the other in round robin fashion.
But it would be better to simply hand off to the first available one. I could track that state in the parent actor, but I was wondering if something like this could be done simpler and if its already supported by the framework?
I'm using simple scala actors, rather than AKKA, but I'm open to all suggestions.
Thanks.
Upvotes: 2
Views: 542
Reputation: 26579
Sounds like a perfect use-case for a Router with a RoundRobin strategy: http://doc.akka.io/docs/akka/2.0/scala/routing.html
akka-actor-2.0.jar is just 1 dependency away from awesomeness
Upvotes: 7