6

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:

  1. Is there anyway to add new Akka configuration to an ActorSystem after it has been started?

  2. Is there another way to use Props[MyActor].withDispatcher("any-dispatcher") without the Dispatcher being defined in the ActorSystem configuration?

1 Answer 1

5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.