title: how to send message to every Actor (or ActorRef) in array in Akka?
body: <p>I'm working on eclipse under ubuntu 12.04 with scala 2.10 and Akka 2.2.1.</p>
  
  <pre><code>        // A and B are derived from Node
          val algorithm = if(args(0) &gt; 1)()=&gt; new A else ()=&gt; new B      
  
         /* alternative: 
          val algorithm = if(args(0) &gt; 1) (()=&gt; system.actorOf(Props(new A), name ="A") )
                          else (()=&gt; system.actorOf(Props(new B),name="B"))
         */       
          // alternative : class work(algorithm: ()=&gt;ActorRef, num:Int) {    
          class work(algorithm: ()=&gt; Node, num: Int){
  
             val a = Array.fill(num)(algorithm) // here I wanna create an array with num slots 
                                                  // and objects of A or B in it
             val rand = new Random(System.currentTimeMillis())
             val randomNode = a(rand.nextInt(5))
             def find (x:Int): Array[ActorRef]{....}
             def receive = {        
                case Rumor =&gt; 
              a.foreach(ref=&gt; ref !Init(index, find(x), self))
                  randomNode ! Rumor
                case _ =&gt; println(...)        
             }    
          }
  </code></pre>
  
  <p>update:</p>
  
  <p>I create an array which contains Actor or ActorRef(I am not sure which one I am allowed to use in Akka). But eclipse reports on</p>
  
  <pre><code>case Rumor =&gt; 
     a.foreach(ref=&gt; ref !Init(index, find(x), self))
     randomNode ! Rumor
  </code></pre>
  
  <p>I try several times, but it still does not work.</p>