scala - Queue asynchronous task in Play! - correct way -
i have little play! application(2.1, scala) acts restful front-end java library. web app queues tasks background processing using:
akka.system.scheduler.scheduleonce(duration(0, seconds)) { new taskworker().run(batchid) }
in tasks
controller.
the goal start heavy processing java library, in background.
in advent of scala 2.10 , futures , promises, create more sense refactor queuing leverage new api?
in general, i'm looking way able perform background processing implemented resque ruby library, perhaps having in-process memory queue.(redis-backed queue fine too).
use akka actor
case class batchtask(id: int) class taskactor extends actor { def receive = { case batchtask(batchid) => new taskworker().run(batchid) } } val taskworker = context.actorof(props[taskactor]) taskworker ! batchtask(batchid1) taskworker ! batchtask(batchid2) taskworker ! batchtask(batchid3)
scala playframework redis akka task-queue
No comments:
Post a Comment