title: Akka - resending the "breaking" message
body: <p>In the official <a href="http://doc.akka.io/docs/akka/2.0.4/scala/actors.html#Restart_Hooks">akka 2.0.4 docs</a> it says:</p>
  
  <blockquote>
    <p>An actor restart replaces only the actual actor object; the contents of the mailbox is unaffected by the restart,
    so processing of messages will resume after the postRestart hook returns. The message that triggered the
    exception will not be received again. Any message sent to an actor while it is being restarted will be queued to its
    mailbox as usual.</p>
  </blockquote>
  
  <p>Let's say I have a message that caused my actor to restart. It isn't in the mailbox anymore, so it won't be processed by the actor that will take it's place. If I want this message to be processed by the actor anyways (assuming the order doesn't matter in that case), would it be a bad idea for the actor to send the message to themself on restart? </p>
  
  <p>Some (pseudo)code to show what I mean:</p>
  
  <pre><code>class ResendingActor extends Actor {
    var curMessage: Option[MyMessage] = None
    def receive = {
      case MyMessage(x) =&gt; {
        curMessage = Some(MyMessage(x))
        /* processing */
        curMessage = None
      }
    }
    override def preRestart(reason: Throwable, message: Option[Any]) {
      curMessage match {
        case Some(x) =&gt; self ! x
        case None =&gt; ;
      }
    }
  }
  </code></pre>
  
  <p>This way the message that wasn't processed by the actor before it got restarted is pushed to the end of the queue for the new actor.</p>
  
  <p><strong>So my question is:</strong> Is there any reason I shouldn't be doing this? </p>
  
  <p>The only thing I can think of is that if the message is for some reason malformed, it will never leave the system and cause the actor to be restarted regularly...</p>