I'm doing a few operations on Future
s inside an trait
.
trait MyTrait {
//Future based operations
}
Instead of using ExecutionContext.Implicits.global
for my Future
, I want to use one that is defined in my application.conf
.
akka {
my-batch-dispatcher {
type = Dispatcher
executor = "fork-join-executor"
fork-join-executor {
parallelism-min = 10
parallelism-factor = 2.0
parallelism-max = 10
}
throughput = 20
}
}
Inside my actor I can do a lookup to get the execution context.
implicit val ec = context.system.dispatchers.lookup("akka.my-batch-dispatcher")
Now sure how to do this inside my trait.