Examples of dispatcher()


Examples of akka.actor.ActorSystem.dispatcher()

        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 {
        public void onReceive(Object message) {
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

    final ActorRef frontend = system.actorOf(
        Props.create(TransformationFrontend.class), "frontend");
    final FiniteDuration interval = Duration.create(2, TimeUnit.SECONDS);
    final Timeout timeout = new Timeout(Duration.create(5, TimeUnit.SECONDS));
    final ExecutionContext ec = system.dispatcher();
    final AtomicInteger counter = new AtomicInteger();
    system.scheduler().schedule(interval, interval, new Runnable() {
      public void run() {
        ask(frontend,
            new TransformationJob("hello-" + counter.incrementAndGet()),
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

    public static void main(String... args) throws Exception {
        final ActorSystem system = ActorSystem.create("example");
        final ActorRef persistentActor = system.actorOf(Props.create(ExamplePersistentActor.class));
        final ActorRef view = system.actorOf(Props.create(ExampleView.class));

        system.scheduler().schedule(Duration.Zero(), Duration.create(2, TimeUnit.SECONDS), persistentActor, "scheduled", system.dispatcher(), null);
        system.scheduler().schedule(Duration.Zero(), Duration.create(5, TimeUnit.SECONDS), view, "snap", system.dispatcher(), null);
    }
}
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

        final ActorSystem system = ActorSystem.create("example");
        final ActorRef persistentActor = system.actorOf(Props.create(ExamplePersistentActor.class));
        final ActorRef view = system.actorOf(Props.create(ExampleView.class));

        system.scheduler().schedule(Duration.Zero(), Duration.create(2, TimeUnit.SECONDS), persistentActor, "scheduled", system.dispatcher(), null);
        system.scheduler().schedule(Duration.Zero(), Duration.create(5, TimeUnit.SECONDS), view, "snap", system.dispatcher(), null);
    }
}
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

    system.scheduler()
      .schedule(Duration.Zero(),
        Duration.create(2, TimeUnit.SECONDS),
        persistentActor,
        "scheduled",
        system.dispatcher(),
        null);
    system.scheduler()
      .schedule(Duration.Zero(), Duration.create(5, TimeUnit.SECONDS), view, "snap", system.dispatcher(), null);
  }
}
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

        persistentActor,
        "scheduled",
        system.dispatcher(),
        null);
    system.scheduler()
      .schedule(Duration.Zero(), Duration.create(5, TimeUnit.SECONDS), view, "snap", system.dispatcher(), null);
  }
}
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

    ActorRef producer = system.actorOf(props,"myproducer");
    Camel camel = CamelExtension.get(system);
    // get a future reference to the activation of the endpoint of the Consumer Actor
    Timeout timeout = new Timeout(Duration.create(10, SECONDS));
    Future<ActorRef> activationFuture = camel.activationFutureFor(producer,
      timeout, system.dispatcher());
    //#CamelActivation
    //#CamelDeactivation
    // ..
    system.stop(producer);
    // get a future reference to the deactivation of the endpoint of the Consumer Actor
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

    //#CamelDeactivation
    // ..
    system.stop(producer);
    // get a future reference to the deactivation of the endpoint of the Consumer Actor
    Future<ActorRef> deactivationFuture = camel.deactivationFutureFor(producer,
      timeout, system.dispatcher());
    //#CamelDeactivation
    JavaTestKit.shutdownActorSystem(system);
  }

  public static class MyConsumer extends UntypedConsumerActor {
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

            } else {
              actor.tell(new Op.Divide(r.nextInt(10000), r.nextInt(99) + 1),
                  null);
            }
          }
        }, system.dispatcher());
  }
}
View Full Code Here

Examples of akka.actor.ActorSystem.dispatcher()

            } else {
              actor.tell(new Op.Subtract(r.nextInt(100), r.nextInt(100)), null);
            }

          }
        }, system.dispatcher());

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