I am trying to build an agent based model where part of the model involves agents broadcasting decisions. First I initialize exactly four actors with a tracking parent, then I make them each "declare" their decisions in a specific order.
I expect each to update their parameters with each time a sibling declares its decision, but when I run the code shown below, I get logs about dead letters being encountered. How do I make sure all actors run in order, receive all declarations from siblings and do not terminate until they receive a message to declare themselves?
The main method:
import Member._
val system: ActorSystem = ActorSystem("Abilene0")
try {
val groupMembers = Set("father", "mother", "wife", "husband")
val group: ActorRef = system.actorOf(Group.props(groupMembers), "group")
val father = system.actorOf(Member.props(group, generate(groupMembers)), "father")
val mother = system.actorOf(Member.props(group, generate(groupMembers)), "mother")
val wife = system.actorOf(Member.props(group, generate(groupMembers)), "wife")
val husband = system.actorOf(Member.props(group, generate(groupMembers)), "husband")
father ! Declare
wife ! Declare
husband ! Declare
mother ! Declare
} finally {
system.terminate()
}