Created
January 28, 2012 22:36
-
-
Save samueltardieu/1696035 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
import akka.actor._ | |
import akka.event.Logging | |
object Bug extends App { | |
ActorSystem("Bug").actorOf(Props[Bug]) | |
} | |
class Bug extends Actor with FSM[Int, (Int, Int)] { | |
import FSM._ | |
override val log = Logging(context.system, this) | |
self ! new Exception("foo") | |
startWith(0, (0, 1)) | |
when(0) { | |
case Event('ack, _) => | |
log.info("Received ack") | |
stay | |
case Event(t: Throwable, _) => | |
log.info("Received throwable " + t) | |
self ! new Exception("bar") | |
goto(1) | |
} | |
when(1) { | |
case Event('ack, _) => | |
log.info("Received ack") | |
stay | |
case Ev(t: Throwable) => | |
log.info("Received throwable " + t) | |
stop(Normal) | |
} | |
initialize | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment