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

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

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

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

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

public class Example {

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem _system = ActorSystem.create("CustomRouterExample");
    ActorRef burstyMessageRouter = _system.actorOf(new Props(
        MsgEchoActor.class).withRouter(new BurstyMessageRouter(5,2)));

    for (int i = 1; i <= 13; i++) {
      //sends series of messages in a round robin way to all the actors
      burstyMessageRouter.tell(i);
    }
    _system.shutdown();

  }

}
TOP

Related Classes of org.akka.essentials.java.router.custom.example.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.