Skip to content

Instantly share code, notes, and snippets.

@HDBandit
Created July 17, 2016 16:27
Show Gist options
  • Save HDBandit/62f16fb758b564415b33a0dd61159b40 to your computer and use it in GitHub Desktop.
Save HDBandit/62f16fb758b564415b33a0dd61159b40 to your computer and use it in GitHub Desktop.
class Pong extends ActorWithJMXSupport with ActorLogging with PongMBean{
import Pong._
var lastReceivedMessage = "UNKNOWN"
def receive = {
case PongMessage(text) =>
log.info("In PongActor - received message: {}", text)
lastReceivedMessage = text
}
override def getMXTypeName: String = "InstrumentedPongActor"
override def sendMessage(p1: String): Unit = {
if (p1.equals("end")) {
self ! PoisonPill
} else {
self ! PongMessage(p1)
}
}
}
object Pong {
val props = Props[Pong]
case class PongMessage(text: String)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment