I'm trying to test that I'm loading configurations properly, and just can't
seem to create the configuration properly - and getting nowhere in tracking
down what I'm doing wrong on my own.
Here's a configuration I've created just to try and verify things are
working:
TaskScheduler {
dispatcher = TaskScheduler-dispatcher
}
TaskScheduler-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
fixed-pool-size = 1
}
}
My code that's loading the configuration is following this example
<http://doc.akka.io/docs/akka/snapshot/general/configuration.html>, and is
succeeding without error:
private def combine(content:String,name:String) =
StringUtils.filterEmpty(content).flatMap(conf => {
Try(ConfigFactory.parseString(conf)).recoverWith({
case t:Throwable =>
Log.warn(s"Unable to parse akka configuration ${name}",t)
Failure(t)
}).toOption
}).flatMap(config => {
Try(ConfigFactory.load(config.withFallback(typesafeConfig))).recoverWith({
case t:Throwable =>
Log.warn(s"Unable to apply akka configuration ${name} with default
configuration",t)
Failure(t)
}).toOption
}).foreach(config => {
Log.info(s"Setting akka configuration to include ${name}")
BaseConfiguration.typesafeConfig = config})
However, my code to actually take advantage of the configuration looks like
this, and is failing:
Try({
Log.info(s"Found akka configuration for $configName as
${BaseConfiguration.typesafeConfig.getAnyRef(_configName)}")
val _system = ActorSystem(_configName)
Log.info(s"Found akka dispatcher configuration for
${dispatcherName(_configName)} as
${BaseConfiguration.typesafeConfig.getAnyRef(dispatcherName(_configName))}")
_system.dispatchers.lookup(dispatcherName(_configName))
}).recoverWith({
case t:Throwable =>
Log.debug(s"When loading akka configuration ${_configName}:",t)
Failure(t)
})
showing up like this:
INFO [2016-06-09 17:17:58,036] habari: [ewdE8B4L]Found akka configuration
for Some(TaskScheduler) as {dispatcher=TaskScheduler-dispatcher}
INFO [2016-06-09 17:17:58,042] habari: [ewdE8B4L]Found akka dispatcher
configuration for TaskScheduler-dispatcher as
{executor=thread-pool-executor, thread-pool-executor={fixed-pool-size=1},
type=Dispatcher}
DEBUG [2016-06-09 17:17:58,043] habari: [ewdE8B4L]When loading akka
configuration TaskScheduler:Dispatcher [TaskScheduler-dispatcher] not
configured: akka.ConfigurationException: Dispatcher
[TaskScheduler-dispatcher] not configured
I think there's something simple that I'm missing just in the name of the
dispatcher I'm asking for, but there doesn't seem to be any way to list the
names of the dispatchers the ActorSystem has, so I can't figure out any way
to check what the dispatcher I've configured is actually called. Can anyone
clue me in on what I'm doing wrong?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.