Search code examples
scalaakkaakka-actor

Akka Actors send message to concrete actor


Using Akka actors is it possible to organize actors into a ring and send messages to only two (left, right) neighbors?


Solution

  • As long as the actors have ActorRefs for their left-and-right neighbors, it's definitely possible to organize them into a ring.

    Note you'd have to have a protocol for the actors to be told who their neighbors are (as all actors except the last one in the ring would have a neighbor who hadn't been spawned when that actor spawned (so setting the neighbors via Props wouldn't work)).