I have created akka system. Suppose there are some actors in it. How I can print all actors from akka system with their path? (for debug purposes)
According to the documentation you can use ActorSelection
with a wildcard *
to make actors send identifying messages. You can have an actor that collect the ActorRef
s.
As mentioned by @chris-martin only actors that are not currently busy will send. A very simple actor:
// make all the available actor to send an identifying message
public void freeActors()
{
ActorSelection selection =
getContext().actorSelection("/user/*");
selection.tell(new Identify(identifyId), getSelf());
}
...
// collect responses
@Override
public void onReceive(Object message) {
if (message instanceof ActorIdentity) {
ActorIdentity identity = (ActorIdentity) message;
// get the ref of the sender
ActorRef ref = identity.getRef();
// the sender is up and available
...
EDIT: I know this is for Java, but it seemed helpful to me.