4

Is is usually a great idea to give actors consise names to ease debugging.

In my scenario I have to create lots of actors that take arbitrary short string in constructor and do something with it.

I'd like to include this string into actor name in order to distinguish between these actors but since string is arbitrary there might be chars that are not qualify as valid for akka actor names.

I was thinking about Base64-ing the string before adding it to the name but this will make debug not that pleasant as I will have to de-Base64 it every time I'll neet to know what actor is this.

Another idea was to replace all non-char chars with something, but this may lead to collisions.

Is there a simple way for me to include arbitrary string into actor name, yet be sure that produced name will be valid and readable (i.e. something similar to url-encoding for actor names)?

Eugene Loy
  • 12,224
  • 8
  • 53
  • 79
  • 2
    Every element in actor path (which includes name) should conform to [this regexp](https://github.com/akka/akka/blob/4f463a058b119901b569591684e4118c6fa96f42/akka-actor/src/main/scala/akka/actor/ActorPath.scala#L25). – dvim Oct 06 '14 at 11:53
  • Why do you name them arbitrarily yourself? If you don't give an actor a name, one is generated automatically. –  Oct 08 '14 at 07:24
  • 1
    @rightføld mostly for debug purposes. – Eugene Loy Oct 08 '14 at 11:45

0 Answers0