Package akka.actor

Examples of akka.actor.Props


  @SuppressWarnings("serial")
  public void remoteActorCreationDemo3() {
    log.info("Creating a actor with remote deployment");

    // creating the ServerActor on the specified remote server
    final ActorRef serverActor = system.actorOf(new Props(ServerActor.class),"remoteServerActor");

    // create a local actor and pass the reference of the remote actor
    actor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new ClientActor(serverActor);
      }
    }));
    // send a message to the local client actor
View Full Code Here


  public void onReceive(Object o) throws Exception {
    if (o instanceof Result) {
      workerActor.tell(o, getSender());
    } else if (o instanceof DeadWorker) {
      log.info("Got a DeadWorker message, restarting the worker");
      workerActor = getContext().actorOf(new Props(WorkerActor.class),
          "workerActor");
    } else
      workerActor.tell(o);
  }
View Full Code Here

    system = ActorSystem.create("ServerSys", ConfigFactory.load()
        .getConfig("ServerSys"));
    log = Logging.getLogger(system, this);
    // create the actor
    @SuppressWarnings("unused")
    ActorRef actor = system.actorOf(new Props(ServerActor.class),
        "serverActor");
  }
View Full Code Here

    LoggingAdapter log = Logging.getLogger(system, system);

    Integer originalValue = Integer.valueOf(0);

    ActorRef supervisor = system.actorOf(new Props(SupervisorActor2.class),
        "supervisor");

    log.info("Sending value 8, no exceptions should be thrown! ");
    supervisor.tell(Integer.valueOf(8));
View Full Code Here

  public ActorRef workerActor1;
  public ActorRef workerActor2;

  public SupervisorActor2() {
    workerActor1 = getContext().actorOf(new Props(WorkerActor1.class),
        "workerActor1");
    workerActor2 = getContext().actorOf(new Props(WorkerActor2.class),
        "workerActor2");
  }
View Full Code Here

   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    ActorSystem system = ActorSystem.create("faultTolerance");

    ActorRef supervisor = system.actorOf(new Props(SupervisorActor.class),
        "supervisor");

    supervisor.tell(Integer.valueOf(10));
    supervisor.tell("10");

View Full Code Here

public class TestActorSystem {

  public static void main(String[] args) throws Exception {
    ActorSystem _system = ActorSystem.create("FutureUsageExample");
    ActorRef processOrder = _system.actorOf(new Props(
        ProcessOrderActor.class));
    processOrder.tell(Integer.valueOf(456));

    Thread.sleep(5000);
View Full Code Here

    system = ActorSystem.create("WCMapReduceApp", ConfigFactory.load()
        .getConfig("WCMapReduceApp"));

    // create the aggregate Actor
    aggregateActor = system.actorOf(new Props(AggregateActor.class));

    // create the list of reduce Actors
    reduceRouter = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new ReduceActor(aggregateActor);
      }
    }).withRouter(new RoundRobinRouter(no_of_reduce_workers)));

    // create the list of map Actors
    mapRouter = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new MapActor(reduceRouter);
      }
    }).withRouter(new RoundRobinRouter(no_of_map_workers)));

    // create the overall WCMapReduce Actor that acts as the remote actor
    // for clients
    wcMapReduceActor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new WCMapReduceActor(aggregateActor, mapRouter);
      }
    }).withDispatcher("priorityMailBox-dispatcher"), "WCMapReduceActor");
View Full Code Here

    final String fileName = "Othello.txt";

    ActorSystem system = ActorSystem.create("ClientApplication",
        ConfigFactory.load().getConfig("WCMapReduceClientApp"));

    final ActorRef fileReadActor = system.actorOf(new Props(
        FileReadActor.class));

    final ActorRef remoteActor = system
        .actorFor("akka://WCMapReduceApp@127.0.0.1:2552/user/WCMapReduceActor");

    @SuppressWarnings("serial")
    ActorRef actor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new ClientActor(remoteActor);
      }
    }));
View Full Code Here

    final int no_of_workers = 10;

    system = ActorSystem.create("LoadGeneratorApp");

    final ActorRef appManager = system.actorOf(
        new Props(new UntypedActorFactory() {
          public UntypedActor create() {
            return new JobControllerActor(no_of_msgs);
          }
        }), "jobController");

    router = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new WorkerActor(appManager);
      }
    }).withRouter(new RoundRobinRouter(no_of_workers)));
  }
View Full Code Here

TOP

Related Classes of akka.actor.Props

Copyright © 2018 www.massapicom. 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.