Package org.akka.essentials.wc.mapreduce.example.client

Source Code of org.akka.essentials.wc.mapreduce.example.client.Client

package org.akka.essentials.wc.mapreduce.example.client;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.actor.UntypedActorFactory;
import akka.kernel.Bootable;

import com.typesafe.config.ConfigFactory;

public class Client implements Bootable {

  /**
   * @param args
   */
  public static void main(String[] args) {

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

    @SuppressWarnings("serial")
    ActorRef actor = system.actorOf(new Props(new UntypedActorFactory() {
      public UntypedActor create() {
        return new ClientActor(remoteActor);
      }
    }));

    fileReadActor.tell(fileName,actor);

    remoteActor.tell("DISPLAY_LIST");

    system.shutdown();

  }

  public void shutdown() {
    // TODO Auto-generated method stub

  }

  public void startup() {
    // TODO Auto-generated method stub

  }

}
TOP

Related Classes of org.akka.essentials.wc.mapreduce.example.client.Client

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.