I have an UntypedActor
that needs to read a configurable value from application.conf
. The following line works, but seems a bit long winded.
public class FooUntypedActor extends UntypedActor {
private final long bar = context().system().settings().config().getLong("foo.bar");
// other stuff
}
Is this the correct method of getting a configurable value in Akka?
I should probably make it clear that I am using the Java API.
It's either that or taking the value in its constructor, so you don't have a hard dependency on the configuration.
Akka documentation suggests to create an Extension
and place application specific settings there. The good example for Akka 2.4.7 is specified in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With