Package akka.actor

Examples of akka.actor.ActorRef.tell()


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

        // Tell the 'greeter' to change its 'greeting' message
        greeter.tell(new WhoToGreet("akka"), ActorRef.noSender());

        // Ask the 'greeter for the latest 'greeting'
        // Reply should go to the "actor-in-a-box"
        inbox.send(greeter, new Greet());
View Full Code Here


        // Wait 5 seconds for the reply with the 'greeting' message
        Greeting greeting1 = (Greeting) inbox.receive(Duration.create(5, TimeUnit.SECONDS));
        System.out.println("Greeting: " + greeting1.message);

        // Change the greeting and ask for it again
        greeter.tell(new WhoToGreet("typesafe"), ActorRef.noSender());
        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
View Full Code Here

            listener);
      }
    }), "master");

    // start the calculation
    master.tell(new Calculate());

  }
}
View Full Code Here

  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");

        Future future = ask(counter, "get", 5000);
View Full Code Here

        ActorSystem system = ActorSystem.create("example");

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

        counter.tell("tick");
        counter.tell("tick");
        counter.tell("tick");

        Future future = ask(counter, "get", 5000);

        future.onSuccess(new OnSuccess<Integer>() {
View Full Code Here

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

        counter.tell("tick");
        counter.tell("tick");
        counter.tell("tick");

        Future future = ask(counter, "get", 5000);

        future.onSuccess(new OnSuccess<Integer>() {
            public void onSuccess(Integer count) {
View Full Code Here

    }

    @Test
    public void testCreateOperation() throws Exception {
        ActorRef ref = createActorRef();
        ref.tell(getClass());

        Thread.sleep(1000);

        Operation operation = getLastEntered();
        Operation expected = new Operation().type(AkkaDefinitions.OperationTypes.AKKA_OP_UNTYPED_ACTOR)
View Full Code Here

        @Override
        public void run() {
          try {
            slaveProgressMessage progressMessage = (slaveProgressMessage) Await
                .result(progress, duration);
            m.tell(new notCongestionSignal(), ActorRef.noSender());
            if (progressMessage.completed) {
              if (!collectedManager.containsKey(m)) {
                completedButNotCollectedManager.add(m);
                collectedManager.put(m, true);
              }
View Full Code Here

                  fqdn
                ));

        workers.add(worker);

        worker.tell(AggregationWorker.MessageType.PROCESS_REQUEST,
            getSelf());

      }// end for loop
     
      //TODO
View Full Code Here

      } catch (InterruptedException e) {
        e.printStackTrace();
      }
     
      // origin manager
      worker.tell(
          OperationWorker.MessageType.PROCESS_REQUEST,
          originalManager);

      processedWorkerCount++;
      trueProcessedWorkerCount++;
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.