There is a requirement to run 1 thousand operations asynchoniosly, I've chosen to use Akka.
Warpping in Actor Ref executor and sending 1 thousand messages to ref.
How can I be sure that:
- all 1 thousand messages will be dispatched in asnc way
- each will hold the separate, in-depended thread (that is requirement because of io usage).
You can use the PinnedDispatcher
to guarantee one thread per actor, and everything in Akka is async, so you can be guaranteed the messages are async. If you send your messages using the !
operator, the message is sent in a fire-and-forget manner.
See this for more details.
Try to use PinnedDispatcher
Configuration example & code is here
No blocking until bounded mailbox will be used
Thanks all for the responses, actually for my case combination of
RoundRobinRouter (where number of routes is equal to number of expected threads) and PinnedDispatcher with flag thread-pool-executor.allow-core-timeout=off is working fine.