-
Notifications
You must be signed in to change notification settings - Fork 8
/
Runner.scala
33 lines (23 loc) · 914 Bytes
/
Runner.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package actor_system
import actor_system.actor.{Listener, Master}
import actor_system.message.RunWorkersMsg
import akka.actor.{ActorSystem, Props}
/**
* Created by pabloperezgarcia on 18/12/2016.
*/
object Runner extends App {
run(numberOfWorkers = 10, numberOfElements = 10, numberOfMessages = 50)
// actors and messages ...
def run(numberOfWorkers: Int, numberOfElements: Int, numberOfMessages: Int) {
// Create an Akka system
val system = ActorSystem("Politron-Chief")
system.mailboxes.deadLetterMailbox
// create the result listener, which will print the result and shutdown the system
val listener = system.actorOf(Props[Listener], name = "listener")
// create the master
val master = system.actorOf(Props(
new Master(numberOfWorkers, numberOfMessages, numberOfElements, listener)), name = "master")
// start the tasks
master ! RunWorkersMsg
}
}