Hi,
I'm using Akka 2.3.5 with Java 8. I would like to use a custom dispatcher for some db-related actors, and use the default otherwise. Even though my actor seems to be created with the correct dispatcher (which it tells me so in the logs below), the actual dispatcher it is using is the default dispatcher. I'm not sure what is missing in this setup.
Please help!
Below, I am associating the RedisStatusSyncActor with the db-dispatcher via code (configuration is not working for this either). As you can see in the highlighted log below, the dispatcher it reports having is db-dispatcher, but the thread that is logging that line in the actor is the default dispatcher - Abc-akka.actor.default-dispatcher-3
In application.conf:
akka {
actor {
db-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
core-pool-size-min = 2
core-pool-size-factor = 2.0
core-pool-size-max = 4
}
throughput = 5
}
deployment {
StatusSyncActor {
sync-interval-millis = 120000
}
}
}
}
Created RedisStatusSyncActor In ParentActor.java:
public static final String DB_THREAD_POOL_DISPATCHER = "akka.actor.db-dispatcher";
....
context().actorOf(RedisStatusSyncActor.props(configuration, statusRedisConfiguration, eventBus).withDispatcher(DB_THREAD_POOL_DISPATCHER));
log:
2014-10-15 22:20:39,328 [main] INFO com.abc.system - Starting system.
2014-10-15 22:20:39,402 [Abc-akka.actor.default-dispatcher-3] INFO c.a.s.actor.AbcActor - Starting db actor
2014-10-15 22:20:39,412 [Abc-akka.actor.default-dispatcher-3] INFO c.a.s.r.actor.RedisStatusSyncActor - getContext().props().dispatcher() is akka.actor.db-dispatcher, context.dispatcher is Dispatcher[akka.actor.db-dispatcher]
2014-10-15 22:20:39,413 [Abc-akka.actor.default-dispatcher-3] INFO c.a.s.r.actor.RedisStatusSyncActor - Started RedisStatusSyncActor
----------------------------------------------
The other weird thing I noticed is that if I cut short the application.conf without the "deployment" section, then it does actually use the db-dispatcher. Wonder why?
Thanks in advance for any insight you guys can provide!
L