How to configure a dispatcher?
In the Akka framework, each AkkaSystem has a default MessageDispatcher
. An Actor uses that default dispatcher, if no dispatcher is configured to it. If required, we can configure our application required MessageDispatcher
.
In the Akka framework, the Dispatcher component internally uses Java's Executor framework to execute tasks asynchronously. The Akka framework has provided the following implementations of Java's Executor framework:
default-executor
: It is the default Executor implementation used by the Akka framework if we don't provide this configuration. It usesjava.util.concurrent.ExecutorService
to execute asynchronous tasks.fork-join-executor
: It uses Java's Fork/Join Executor framework to execute asynchronous tasks.thread-pool-executor
: It uses a predefined thread pool to execute asynchronous tasks.
The Akka dispatcher works based on the configured underlying threading model.
We can configure a dispatcher to work with only one Actor, a group of Actors...