scala - Not able to lookup a custom dispatcher -
i using play 2.3.7 , need use actors inside controller. following code working fine
implicit val system = actorsystem() implicit val dispatcher = system.dispatcher val future = (io(http) ? get(url).withheaders(...).mapto[httpresponse] val result = await.results(future, duration.inf)
now make following change conf/application.conf
play { akka { actor { default-dispatcher { type = dispatcher executor = "thread-pool-executor" thread-pool-executor { fixed-pool-size = 128 } } foo-dispatcher { type = dispatcher executor = "thread-pool-executor" thread-pool-executor { fixed-pool-size = 128 } } } } }
and now, change code to
implicit val system = actorsystem() implicit val dispatcher = system.dispatchers.lookup("foo-dispatcher") val future = (io(http) ? get(url).withheaders(...).mapto[httpresponse] val result = await.results(future, duration.inf)
i exception message [foo-dispatcher] not configured
reference full path:
implicit val dispatcher = system.dispatchers.lookup("play.akka.actor.foo-dispatcher")
if want use system.dispatchers.lookup("foo-dispatcher")
, define foo-dispatcher
outside of play
namespace:
play { akka { actor { default-dispatcher { type = dispatcher executor = "thread-pool-executor" thread-pool-executor { fixed-pool-size = 128 } } } } } foo-dispatcher { type = dispatcher executor = "thread-pool-executor" thread-pool-executor { fixed-pool-size = 128 } }
Comments
Post a Comment