Created
January 28, 2015 03:11
-
-
Save eodgooch/b8959a52079e07426e0d to your computer and use it in GitHub Desktop.
ConsoleListener to add to our chap application
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
import akka.actor.Actor | |
/** | |
* Let's take a look at this to get an idea of how to open up a console window | |
* https://github.com/sdanzig/buddychat/blob/master/src/main/scala/scottdanzig/buddychat/actors/ConsoleActor.scala | |
*/ | |
class KeyBoardListener extends Actor { | |
implicit ec = context.dispatcher | |
override def preStart() = { | |
} | |
def receive: Receive = { | |
case Start => setup() | |
case _ => throw new IllegalArgumentException("KeyBoardListener only Starts") | |
} | |
def setup(){ | |
println("keyboard Running") | |
var line: String = "" | |
while (true) { | |
println("here") | |
line = Console.readLine() | |
context.actorSelection("..") ! line | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment