Created
August 7, 2015 03:45
-
-
Save xianminx/9fc83b0cf76ebf214651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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