Package akka.actor

Examples of akka.actor.Props


  public static void main(String[] args) throws Exception {

    ActorSystem _system = ActorSystem.create("BecomeUnbecome");
    ActorRef pingPongActor = _system
        .actorOf(new Props(PingPongActor.class));

    pingPongActor.tell(PingPongActor.PING, pingPongActor);

    Thread.sleep(2000);
View Full Code Here


  }

  @Test
  public void resumeTest() throws Exception {
    TestActorRef<SupervisorActor> supervisor = TestActorRef.apply(
        new Props(SupervisorActor.class), _system);

    //first send a correct message
    supervisor.tell(Integer.valueOf(8));
    //Send a  message that generates exception
    supervisor.tell(Integer.valueOf(-8));
View Full Code Here

*/
public class LocalNodeApplication {
  public static void main(String[] args) throws Exception {
    ActorSystem _system = ActorSystem.create("LocalNodeApp",ConfigFactory
        .load().getConfig("LocalSys"));
    ActorRef localActor = _system.actorOf(new Props(LocalActor.class));
    localActor.tell("Hello");

    Thread.sleep(5000);
    _system.shutdown();
  }
View Full Code Here

        super(_system);
    }

    @Test
    public void successTest() throws Exception {
        ActorRef bank = _system.actorOf(new Props(BankActor.class));
        bank.tell(new TransferMsg(Float.valueOf("1777")));

        AccountBalance balance = (AccountBalance) Await.result(
                ask(bank, new AccountBalance("XYZ"), 5000),
                Duration.create("5 second"));
View Full Code Here

    }

    @Test
    public void failureTest() throws Exception {
        ActorRef bank = _system.actorOf(new Props(BankActor.class));

        bank.tell(new TransferMsg(Float.valueOf("5500")));

        // sleeping to allow some time for actors to be restarted
        Thread.sleep(4000);
View Full Code Here

  public TestApp() {

    ActorSystem _system = ActorSystem.create("Extension-Test",
        ConfigFactory.load().getConfig("TestApp"));

    ActorRef ref = _system.actorOf(new Props(MyActor.class));
   
    ref.tell("msg");

    MySQLJDBCSettingsImpl mysqlSetting = MySQLJDBCSettings.SettingsProvider
        .get(_system);
View Full Code Here

    }

    @Test
    public void accountTest() throws Exception {
        ActorRef bank = _system.actorOf(new Props(BankActor.class));

        bank.tell(new AccountDebit(Float.parseFloat("1000")));
        bank.tell(new AccountCredit(Float.parseFloat("1000")));
        bank.tell(new AccountDebit(Float.parseFloat("1000")));
        bank.tell(new AccountDebit(Float.parseFloat("1000")));
View Full Code Here

   */
  public static void main(String[] args) {
    ActorSystem _system = ActorSystem.create("callingThread-dispatcher",
        ConfigFactory.load().getConfig("MyDispatcherExample"));
   
    ActorRef actor = _system.actorOf(new Props(MsgEchoActor.class)
        .withDispatcher("CallingThreadDispatcher").withRouter(
            new RoundRobinRouter(2)));

    for (int i = 0; i < 5; i++) {
      actor.tell(i);
View Full Code Here

        .getConfig("WorkServerSys"));
    log = Logging.getLogger(system, this);

    // create the work scheduler actor
    workSchedulerActor = system.actorOf(
        new Props(WorkSchedulerActor.class), "WorkSchedulerActor");

    // create the job controller actor, which manages the routees and sends
    // out
    // work packets to the registered workers
    jobControllerActor = system.actorOf(new Props(
        new UntypedActorFactory() {
          public UntypedActor create() {
            return new JobControllerActor(workSchedulerActor);
          }
        }), "JobControllerActor");
   
    remoteActorListener = system.actorOf(new Props(
        new UntypedActorFactory() {
          public UntypedActor create() {
            return new RemoteClientEventListener(jobControllerActor);
          }
        }), "RemoteClientEventListener");


    // actor that registers and unregisters the workers
    registerRemoteWorkerActor = system.actorOf(new Props(
        new UntypedActorFactory() {
          public UntypedActor create() {
            return new RegisterRemoteWorkerActor(jobControllerActor);
          }
        }), "RegisterRemoteWorkerActor");
View Full Code Here

        super(_system);
    }

    @Test
    public void successTest() throws Exception {
        TestActorRef<BankActor> bank = TestActorRef.apply(new Props(
                BankActor.class), _system);

        bank.tell(new TransferMsg(Float.valueOf("1777")));

        AccountBalance balance = (AccountBalance) Await.result(
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.