Hi lakshmi!
You have properly found the reason why this is so:
> 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?

Configuration for dispatchers (in general the entire "Deploy" section) in
the config object takes precedence over hardcoded things in the code.
The reasoning is that you code in one thing, but then based on environment
want to reconfigure things in your app (on this server I give file A, so
it's using A settings, on another one I give file B, so it's using B
settings

It's mentioned in the docs for dispatchers
<http://doc.akka.io/docs/akka/snapshot/scala/dispatchers.html#setting-the-dispatcher-for-an-actor>
:
    If you define the dispatcherin the deployment configuration then this
value will be used instead of programmatically provided parameter.
as well as routing docs
<http://doc.akka.io/docs/akka/snapshot/scala/routing.html#a-router-actor>
(because that's where you'll very often use the deploy section).


Hope this helps!

-- Konrad


On Thu, Oct 16, 2014 at 7:46 AM, lakshmi <[email protected]> wrote:

> 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
>
> --
> >>>>>>>>>> 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 http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe

<http://typesafe.com>

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to