Examples of actorOf()


Examples of akka.actor.ActorSystem.actorOf()

    public static void main(String[] args) {
        // Create the 'helloakka' actor system
        final ActorSystem system = ActorSystem.create("helloakka");

        // Create the 'greeter' actor
        final ActorRef greeter = system.actorOf(Props.create(Greeter.class), "greeter");

        // Create the "actor-in-a-box"
        final Inbox inbox = Inbox.create(system);

        // Tell the 'greeter' to change its 'greeting' message
View Full Code Here

Examples of akka.actor.ActorSystem.actorOf()

        inbox.send(greeter, new Greet());
        Greeting greeting2 = (Greeting) inbox.receive(Duration.create(5, TimeUnit.SECONDS));
        System.out.println("Greeting: " + greeting2.message);

        // after zero seconds, send a Greet message every second to the greeter with a sender of the GreetPrinter
        ActorRef greetPrinter = system.actorOf(Props.create(GreetPrinter.class));
        system.scheduler().schedule(Duration.Zero(), Duration.create(1, TimeUnit.SECONDS), greeter, new Greet(), system.dispatcher(), greetPrinter);
        //system.shutdown();
    }

    public static class GreetPrinter extends UntypedActor {
View Full Code Here

Examples of akka.actor.ActorSystem.actorOf()

    // Create an Akka system
    ActorSystem system = ActorSystem.create("PiSystem");

    // create the result listener, which will print the result and shutdown
    // the system
    final ActorRef listener = system.actorOf(new Props(Listener.class),
        "listener");

    // create the master
    ActorRef master = system.actorOf(new Props(new UntypedActorFactory() {
      private static final long serialVersionUID = 1L;
View Full Code Here

Examples of akka.actor.ActorSystem.actorOf()

    // the system
    final ActorRef listener = system.actorOf(new Props(Listener.class),
        "listener");

    // create the master
    ActorRef master = system.actorOf(new Props(new UntypedActorFactory() {
      private static final long serialVersionUID = 1L;

      public UntypedActor create() {
        return new Master(nrOfWorkers, nrOfMessages, nrOfElements,
            listener);
View Full Code Here

Examples of akka.actor.ActorSystem.actorOf()

    @SuppressWarnings({ "rawtypes", "unchecked" })
  public static void main(String... args) {
        ActorSystem system = ActorSystem.create("example");

        ActorRef counter = system.actorOf(new Props(Counter.class));

        counter.tell("tick");
        counter.tell("tick");
        counter.tell("tick");
View Full Code Here

Examples of akka.actor.ActorSystem.actorOf()

    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

Examples of akka.actor.ActorSystem.actorOf()

   * @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

Examples of akka.actor.ActorSystem.actorOf()

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

Examples of akka.actor.ActorSystem.actorOf()

    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");
View Full Code Here

Examples of akka.actor.ActorSystem.actorOf()

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