title: Akka Java FSM by Example
body: <p><strong>Please note:</strong> I am a Java developer with no working knowledge of Scala (sadly). I would ask that any code examples provided in the answer would be using Akka's Java API.</p>
  
  <p>I am trying to use the Akka FSM API to model the following super-simple state machine. In reality, my machine is much more complicated, but the answer to this question will allow me to extrapolate to my actual FSM.</p>
  
  <p><img src="https://i.stack.imgur.com/ZTdIt.png" alt="enter image description here"></p>
  
  <p>And so I have 2 states: <code>Off</code> and <code>On</code>. You can go fro <code>Off -&gt; On</code> by powering the machine on by calling <code>SomeObject#powerOn(&lt;someArguments&gt;)</code>. You can go from <code>On -&gt; Off</code> by powering the machine off by calling <code>SomeObject#powerOff(&lt;someArguments&gt;)</code>.</p>
  
  <p>I'm wondering what actors and supporting classes I'll need in order to implement this FSM. I <em>believe</em> the actor representing the FSM has to extend <code>AbstractFSM</code>. But what classes represent the 2 states? What code exposes and implements the <code>powerOn(...)</code> and <code>powerOff(...)</code> state transitions? A working Java example, or even just Java pseudo-code, would go a long way for me here.</p>