I have a Master actor which creates Worker actors using router. Each Worker actor performs several HTTP connections.
And from several sources I learnt that if actor doing some blocking operation, then it's better to wrap blocking operation into this construct:
val resFut = future {
blocking {
executeQuery()
}
}
resFut pipeTo sender
But then I read official topic about handling blocking operations in Akka, and I was surprised that topic suggest just to use router for blocking operations (as alternative to Futures):
Do the blocking call within an actor (or a set of actors managed by a router), making sure to configure a thread pool which is either dedicated for this purpose or sufficiently sized.
So my question is: should I use following construct in my Worker actor even if it backed by router?
future {
blocking {
executeQuery()
}
}
Or just configuring and using another dispatcher for router will help me to achieve same benefits?