Package org.akka.essentials.java.dispatcher.example.Dispatcher

Source Code of org.akka.essentials.java.dispatcher.example.Dispatcher.Example1

package org.akka.essentials.java.dispatcher.example.Dispatcher;

import org.akka.essentials.java.dispatcher.MsgEchoActor;

import com.typesafe.config.ConfigFactory;

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

/**
* Hello world!
*
*/
public class Example1 {
  public static void main(String[] args) {
    ActorSystem _system = ActorSystem.create("default-dispatcher",
        ConfigFactory.load().getConfig("MyDispatcherExample"));
   
    ActorRef actor = _system.actorOf(new Props(MsgEchoActor.class)
        .withDispatcher("defaultDispatcher").withRouter(
            new RoundRobinRouter(5)));

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

    _system.shutdown();
  }
}
TOP

Related Classes of org.akka.essentials.java.dispatcher.example.Dispatcher.Example1

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.