Package akka.actor

Examples of akka.actor.Address


  @SuppressWarnings("serial")
  public void remoteActorCreationDemo1() {
    log.info("Creating a actor using remote deployment mechanism");

    // 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))));
View Full Code Here


  public void remoteActorCreationDemo2() {
    log.info("Creating a actor with remote deployment");

    // alternate way to create the address object that points to the remote
    // 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))));
View Full Code Here

    // get the reference to the remote server actor
    registerRemoteWorkerActor = system
        .actorFor("akka://WorkServerSys@127.0.0.1:2552/user/RegisterRemoteWorkerActor");
   
    // create the worker address message
    Address myAddr = new Address("akka", "WorkerSys", "127.0.0.1", port);
    // send a message to server to register this worker instance
    registerRemoteWorkerActor.tell(new StartWorker(myAddr.toString()));
  }
View Full Code Here

  @Override
  public void onReceive(Object message) {
    if (message.equals("tick") && !nodes.isEmpty()) {
      // just pick any one
      List<Address> nodesList = new ArrayList<Address>(nodes);
      Address address = nodesList.get(ThreadLocalRandom.current().nextInt(
          nodesList.size()));
      ActorSelection service = getContext().actorSelection(address + servicePath);
      service.tell(new StatsJob("this is the text that will be analyzed"),
          getSelf());
View Full Code Here

  @Test
  public void demonstrateRemoteDeploy() {
    //#remoteRoutees
    Address[] addresses = {
      new Address("akka.tcp", "remotesys", "otherhost", 1234),
      AddressFromURIString.parse("akka.tcp://othersys@anotherhost:1234")};
    ActorRef routerRemote = system.actorOf(
      new RemoteRouterConfig(new RoundRobinPool(5), addresses).props(
        Props.create(Echo.class)));
    //#remoteRoutees
View Full Code Here

  private final ActorSystem system = actorSystemResource.getSystem();
 
  @Test
  public void demonstrateDeployment() {
    //#make-address
    Address addr = new Address("akka.tcp", "sys", "host", 1234);
    addr = AddressFromURIString.parse("akka.tcp://sys@host:1234"); // the same
    //#make-address
    //#deploy
    ActorRef ref = system.actorOf(Props.create(SampleActor.class).withDeploy(
      new Deploy(new RemoteScope(addr))));
View Full Code Here

TOP

Related Classes of akka.actor.Address

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.