Skip to content

Instantly share code, notes, and snippets.

@rkuhn
Last active December 16, 2015 17:49
Show Gist options
  • Save rkuhn/5472884 to your computer and use it in GitHub Desktop.
Save rkuhn/5472884 to your computer and use it in GitHub Desktop.
sample snippets for Props spotlight blogpost
final ActorRef child = getContext().actorOf(new Props(
new UntypedActorFactory() {
@Override public UntypedActor create() {
// getSender() will not yield what you think it should
return new OtherActor(getSender());
}
}))
// it is completely random what that actor’s constructor arg will be
val child = context.actorOf(Props(new OtherActor(sender)))
final ActorRef child =
getContext().actorOf(Props.create(OtherActor.class, getSender()));
val child = context.actorOf(Props(classOf[OtherActor], sender))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment