Package akka.actor

Examples of akka.actor.Props


            this.injector = injector;
        }

        @Override
        public ActorRef get() {
            return Akka.system().actorOf(new Props(new UntypedActorFactory() {
                public T create() {
                    return injector.getInstance(Key.get(uta));
                }
            }));
        }
View Full Code Here


    // 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;

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

      this.nrOfMessages = nrOfMessages;
      this.nrOfElements = nrOfElements;
      this.listener = listener;

      workerRouter = this.getContext().actorOf(
          new Props(Worker.class).withRouter(new RoundRobinRouter(
              nrOfWorkers)), "workerRouter");
    }
View Full Code Here

    @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

    public final void closeAkka() {
        actorSystem.shutdown();
    }

    protected final ActorRef createActorRef() {
        actorRef = actorSystem.actorOf(new Props(SimpleUntypedActor.class), TEST_ACTOR_NAME);
        return actorRef;
    }
View Full Code Here

        {
            logger.debug("Injecting at: {}", instance);
            logger.debug("Annotation: {}", field.getAnnotations());
        }

        Props props = Props.create(factory.creator(aClass));
        try
        {
            field.set(instance, props);
        }
        catch (IllegalAccessException e)
View Full Code Here

    }

    protected <C extends GenericActor> TestActorRef<C> createTestActor(Class<C> clazz, String actorName)
    {
        final DiAwareCreatorFactory factory = injector.getInstance(DiAwareCreatorFactory.class);
        final Props props = Props.create(factory.creator(clazz));
        TestActorRef<C> testActorRef = TestActorRef.create(system, props, actorName);
        watchingProbe.watch(testActorRef);

        return testActorRef;
    }
View Full Code Here

        .actorFor("akka://ServerSys@127.0.0.1:2552/user/serverActor");

    log.info("ServerActor with hashcode #" + remoteActor.hashCode());
   
    // 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(remoteActor);
      }
    }));
    // send a message to the local client actor
View Full Code Here

    // create the address object that points to the remote server
    Address addr = new Address("akka", "ServerSys", "127.0.0.1", 2552);

    // creating the ServerActor on the specified remote server
    final ActorRef serverActor = system.actorOf(new Props(ServerActor.class)
        .withDeploy(new Deploy(new RemoteScope(addr))));

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

    // server
    Address addr = AddressFromURIString
        .parse("akka://ServerSys@127.0.0.1:2552");

    // creating the ServerActor on the specified remote server
    final ActorRef serverActor = system.actorOf(new Props(ServerActor.class)
        .withDeploy(new Deploy(new RemoteScope(addr))));

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

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.