Package akka.actor

Examples of akka.actor.ActorSystem.actorOf()


  /**
   * @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
View Full Code Here


  public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    ActorSystem system = ActorSystem.create("DurableMailBox", ConfigFactory
        .load().getConfig("myapp1"));

    ActorRef actor = system
        .actorOf(new Props(DurableMailBox.class)
            .withDispatcher("my-dispatcher"), "serverActor");

    actor.tell("Hello");
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(WorkerTaskA.class), "workerA");
    system.actorOf(new Props(WorkerTaskB.class), "workerB");
    system.actorOf(new Props(RouterActor.class), "router");
  }

}
View Full Code Here

   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(WorkerTaskA.class), "workerA");
    system.actorOf(new Props(WorkerTaskB.class), "workerB");
    system.actorOf(new Props(RouterActor.class), "router");
  }

}
View Full Code Here

   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(WorkerTaskA.class), "workerA");
    system.actorOf(new Props(WorkerTaskB.class), "workerB");
    system.actorOf(new Props(RouterActor.class), "router");
  }

}
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem _system = ActorSystem.create("BroadcastRouterExample");
    ActorRef broadcastRouter = _system.actorOf(new Props(MsgEchoActor.class)
        .withRouter(new BroadcastRouter(5)),"myBroadcastRouterActor");

    for (int i = 1; i <= 2; i++) {
      //same message goes to all the actors
      broadcastRouter.tell(i);
View Full Code Here

   * @param args
   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    ActorSystem _system = ActorSystem.create("RandomRouterExample");
    ActorRef randomRouter = _system.actorOf(new Props(MsgEchoActor.class)
        .withRouter(new RandomRouter(5)),"myRandomRouterActor");

    for (int i = 1; i <= 10; i++) {
      //sends randomly to actors
      randomRouter.tell(i);
View Full Code Here

   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    ActorSystem _system = ActorSystem
        .create("ScatterGatherFirstCompletedRouterExample");
    ActorRef scatterGatherFirstCompletedRouter = _system.actorOf(new Props(
        RandomTimeActor.class)
        .withRouter(new ScatterGatherFirstCompletedRouter(5, Duration
            .create(2, "seconds"))),
        "myScatterGatherFirstCompletedRouterActor");

View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(PushActor.class), "push");
    system.actorOf(new Props(PullActor1.class), "pull1");
    system.actorOf(new Props(PullActor2.class), "pull2");
  }

}
View Full Code Here

   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(PushActor.class), "push");
    system.actorOf(new Props(PullActor1.class), "pull1");
    system.actorOf(new Props(PullActor2.class), "pull2");
  }

}
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.