Package org.akka.essentials.java.router.example.smallestmailbox

Source Code of org.akka.essentials.java.router.example.smallestmailbox.Example

package org.akka.essentials.java.router.example.smallestmailbox;

import org.akka.essentials.java.router.example.MsgEchoActor;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.routing.SmallestMailboxRouter;

public class Example {

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem _system = ActorSystem.create("SmallestMailBoxRouterExample");
    ActorRef smallestMailBoxRouter = _system.actorOf(new Props(MsgEchoActor.class)
        .withRouter(new SmallestMailboxRouter(5)),"mySmallestMailBoxRouterActor");

    for (int i = 1; i <= 10; i++) {
      //works like roundrobin but tries to rebalance the load based on
      //size of actor's mailbox
      smallestMailBoxRouter.tell(i);
    }
    _system.shutdown();

  }

}
TOP

Related Classes of org.akka.essentials.java.router.example.smallestmailbox.Example

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.