I have a scenario where I create actors on demand. I want to be able to define a Dispatcher
and attach it to my actor programmatically.
The deal is: My ActorSystem
is already running, which mean that it have already loaded all the Akka
configurations.
Seems like the Dispatcher
has to be defined in the application.conf
before creating the ActorSystem
, so I have two questions:
Is there anyway to add new Akka
configuration to an ActorSystem
after it has been started?
Is there another way to use Props[MyActor].withDispatcher("any-dispatcher")
without the Dispatcher
being defined in the ActorSystem
configuration?
No, the dispatchers must be configured when the actor system is started, they can not be defined dynamically.
If you have an app where you can restart the actor system the config library has options to programmatically define blocks, so you could generate a config based on the default one and then pass that config to the ActorSystem
when you create it.
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