Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PostStart implementation for Akka
trait PostStart { actor: Actor =>
def postStart: Unit
override def preStart {
actor.become {
case "PostStart" => try { postStart } finally { actor.unbecome }
}
actor.self ! "PostStart"
}
}
/*Usage: class MyActor extends Actor with PostStart {
def postStart = {
...
}
def receive = {
... your usual business stuff goes here ...
}
}*/
@alaz
override def preStart {
  super.preStart
  ...

?

@viktorklang
Owner

Alaz: Care to write that in code?

@alaz

The pleasure is all mine

@twillouer

Hi,

trait PostStart { actor: Actor =>
  def postStart: Unit

  override def preStart {
    context.become {
      case "PostStart" => try { postStart } finally { context.unbecome }
    }
    actor.self ! "PostStart"
  }
}

with Akka 2.1 (I didn't see this version)

@raq154

Can you provide java version of this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.