Configuration of an actor system affects the way in which the Akka actor libraries and microkernel interact with actors. The visibility of a configuration is limited to the specific actor system with which the configuration has been associated. The effective configuration for any given actor system is a merger of three sources. In Fig. 1 below the precedence of overriding values flows from the top of the stack ( highest precedence ) to the bottom.Fig. 1 Configuration Stack
|system properties||Java system properties.|
|application.conf||File contains application specific overrides to the file reference.conf below.|
|reference.conf||File contains the entire set of Akka actor default configuration values.|
Why Would You Want To Configure
Although the Akka actor libraries and microkernel can work to an extent without intentional configuration by relying on values from reference.conf here are some of the reasons why in practice you will want to configure your actor application.
- You need interoperation between more than one actor system.
- You need to use remote hosts to run your actor systems.
- You need to create actors from a remote console.
- For compatibility with a remote host you need to change the transport protocol from the default to something else.
- You need to multicast messages to groups of actors and would like to use one of the routers that comes with the Akka actor distribution instead of writing your own router.
- Your application requires that more than one actor share the same queue of messages ( share same mailbox ).
- For crash recovery you want to implement durable mailboxes. Durable mailboxes are actor mailboxes that are backed up by a persistent store. Saved messages flow again when the system restarts.
- You are tasked with implementing a highly reliable and performant failover enabled cluster of servers to meet stringent processing demands.
- As a way of defining the characteristics of software transactional memory ( STM ) that is operating in your transaction based application.
- You want to protect your actor system from external attack.
- You are in development and need debugging information.
- Company auditors and/or security require logging of operations to be done in a prescribed way.
Scope of This ExerciseConfiguration of an actor system is a vast subject. Configurations that will be covered here are limited to useful common configuration patterns that have local scope. Configuring for remote operations is the subject of a future post. We will be learning to manipulate application.conf, the application specific source for configuration information. The global reference.conf file will be left without modification; always preferring to override default values at the application level.
What You Will Need
- Akka actor distribution 2.2.1. See attached AkkaHelp.html file for download and deployment directions.
- A local Java actor application to apply the configuration to. For instance you can use the source for the