Examples of RoundRobinRouter


Examples of akka.routing.RoundRobinRouter

        addressNodes);

    // update the workerRouter actor with the information on all workers
    workerRouterActor = getContext().system().actorOf(
        new Props(WorkerActor.class).withRouter(new RemoteRouterConfig(
            new RoundRobinRouter(workerAddress.length),
            workerAddress)));

  }
View Full Code Here

Examples of akka.routing.RoundRobinRouter

          addressNodes);

      workerRouterActor = getContext().system().actorOf(
          new Props(WorkerActor.class)
              .withRouter(new RemoteRouterConfig(
                  new RoundRobinRouter(workerAddress.length),
                  workerAddress)));
    } else
      workerRouterActor = null;

  }
View Full Code Here

Examples of akka.routing.RoundRobinRouter

    ActorSystem _system = ActorSystem.create("balancing-dispatcher",
        ConfigFactory.load().getConfig("MyDispatcherExample"));
   
    ActorRef actor = _system.actorOf(new Props(MsgEchoActor.class)
        .withDispatcher("balancingDispatcher").withRouter(
            new RoundRobinRouter(5)));

    for (int i = 0; i < 25; i++) {
      actor.tell(i);
    }
View Full Code Here

Examples of akka.routing.RoundRobinRouter

   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqClientTest");
    system.actorOf(new Props(ClientActor.class)
        .withRouter(new RoundRobinRouter(3)), "client");
  }
View Full Code Here

Examples of akka.routing.RoundRobinRouter

   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    ActorSystem _system = ActorSystem.create("RoundRobinRouterExample");
    ActorRef roundRobinRouter = _system.actorOf(new Props(
        MsgEchoActor.class).withRouter(new RoundRobinRouter(5)),"myRoundRobinRouterActor");

    for (int i = 1; i <= 10; i++) {
      //sends messages in a round robin way to all the actors
      roundRobinRouter.tell(i);
      if (i == 5) {
View Full Code Here

Examples of akka.routing.RoundRobinRouter

    for(int i = 0; i < data.size() ; i++) {
      newValues.add(new Object());
    }
    routerActor = this.getContext().actorOf(
      new Props(ActorLevel2.class)
      .withRouter(new RoundRobinRouter(nrOfWorkers)), "roundRobinRouterActor");
  }
View Full Code Here

Examples of akka.routing.RoundRobinRouter

    this.data = data;
    this.nrOfWorkers = nrOfWorkers;
    this.newValues = ListUtils.fixedSizeList(data);
    routerActor = this.getContext().actorOf(
      new Props(ActorLevel2.class)
      .withRouter(new RoundRobinRouter(nrOfWorkers)), "roundRobinRouterActor");
  }
View Full Code Here

Examples of org.jboss.messaging.core.plugin.postoffice.cluster.RoundRobinRouter

      super.tearDown();
   }
  
   public void testSize() throws Exception
   {
      RoundRobinRouter dr = new RoundRobinRouter();
     
      ClusteredQueue queue1 = new SimpleQueue(true);
      dr.add(queue1);
     
      assertEquals(1, dr.getNumberOfReceivers());
      assertEquals(1, dr.getQueues().size());
     
      ClusteredQueue queue2 = new SimpleQueue(false);
      dr.add(queue2);
     
      assertEquals(2, dr.getNumberOfReceivers());
      assertEquals(2, dr.getQueues().size());
     
      ClusteredQueue queue3 = new SimpleQueue(false);
      dr.add(queue3);
     
      assertEquals(3, dr.getNumberOfReceivers());
      assertEquals(3, dr.getQueues().size());
     
      dr.remove(queue3);
     
      assertEquals(2, dr.getNumberOfReceivers());
      assertEquals(2, dr.getQueues().size());
     
      dr.remove(queue2);
     
      assertEquals(1, dr.getNumberOfReceivers());
      assertEquals(1, dr.getQueues().size());
     
      dr.remove(queue1);
     
      assertEquals(0, dr.getNumberOfReceivers());
      assertTrue(dr.getQueues().isEmpty());
     
   }
View Full Code Here

Examples of org.jboss.messaging.core.plugin.postoffice.cluster.RoundRobinRouter

   }
  
   // The router only has a local queue
   public void testRouterOnlyLocal() throws Exception
   {
      RoundRobinRouter dr = new RoundRobinRouter();
                   
      ClusteredQueue queue = new SimpleQueue(true);
     
      SimpleReceiver receiver1 = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);
     
      queue.add(receiver1);
              
      dr.add(queue);
     
      sendAndCheck(dr, receiver1);
     
      sendAndCheck(dr, receiver1);
     
View Full Code Here

Examples of org.jboss.messaging.core.plugin.postoffice.cluster.RoundRobinRouter

   }
  
   //The router has only one non local queues
   public void testRouterOnlyOneNonLocal() throws Exception
   {
      RoundRobinRouter dr = new RoundRobinRouter();
                   
      ClusteredQueue queue = new SimpleQueue(false);
     
      SimpleReceiver receiver1 = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);
     
      queue.add(receiver1);
     
      dr.add(queue);
     
      sendAndCheck(dr, receiver1);
     
      sendAndCheck(dr, receiver1);
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.