Skip to content

Instantly share code, notes, and snippets.

@xianminx
Created August 7, 2015 03:45
Show Gist options
  • Save xianminx/9fc83b0cf76ebf214651 to your computer and use it in GitHub Desktop.
Save xianminx/9fc83b0cf76ebf214651 to your computer and use it in GitHub Desktop.
// 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment