Package akka.actor

Examples of akka.actor.ActorSystem.actorOf()


public class CustomRouteTestBase {
  public void customRoute() throws Exception{
    //#CustomRoute
    ActorSystem system = ActorSystem.create("some-system");
    Camel camel = CamelExtension.get(system);
    ActorRef responder = system.actorOf(Props.create(Responder.class), "TestResponder");
    camel.context().addRoutes(new CustomRouteBuilder(responder));
    //#CustomRoute
    system.stop(responder);
    JavaTestKit.shutdownActorSystem(system);
  }
View Full Code Here


    }
  }

  public static void main(String... args) {
    ActorSystem system = ActorSystem.create("MySystem");
    ActorRef swap = system.actorOf(Props.create(Swapper.class));
    swap.tell(SWAP, ActorRef.noSender()); // logs Hi
    swap.tell(SWAP, ActorRef.noSender()); // logs Ho
    swap.tell(SWAP, ActorRef.noSender()); // logs Hi
    swap.tell(SWAP, ActorRef.noSender()); // logs Ho
    swap.tell(SWAP, ActorRef.noSender()); // logs Hi
View Full Code Here

public class Main2 {

  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("Hello");
    ActorRef a = system.actorOf(Props.create(HelloWorld.class), "helloWorld");
    system.actorOf(Props.create(Terminator.class, a), "terminator");
  }

  public static class Terminator extends UntypedActor {
View Full Code Here

    //#CamelActivation

    // ..
    ActorSystem system = ActorSystem.create("some-system");
    Props props = Props.create(MyConsumer.class);
    ActorRef producer = system.actorOf(props,"myproducer");
    Camel camel = CamelExtension.get(system);
    // get a future reference to the activation of the endpoint of the Consumer Actor
    Timeout timeout = new Timeout(Duration.create(10, SECONDS));
    Future<ActorRef> activationFuture = camel.activationFutureFor(producer,
      timeout, system.dispatcher());
View Full Code Here

public class Main2 {

  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("Hello");
    ActorRef a = system.actorOf(Props.create(HelloWorld.class), "helloWorld");
    system.actorOf(Props.create(Terminator.class, a), "terminator");
  }

  public static class Terminator extends UntypedActor {

    private final LoggingAdapter log = Logging.getLogger(getContext().system(), this);
View Full Code Here

  @Test
  public void systemActorOf() {
    //#system-actorOf
    // ActorSystem is a heavy object: create only one per application
    final ActorSystem system = ActorSystem.create("MySystem");
    final ActorRef myActor = system.actorOf(Props.create(MyUntypedActor.class),
      "myactor");
    //#system-actorOf
    try {
      new JavaTestKit(system) {
        {
View Full Code Here

  }

  public static void startRemoteCreationSystem() {
    final ActorSystem system = ActorSystem.create("CreationSystem",
        ConfigFactory.load("remotecreation"));
    final ActorRef actor = system.actorOf(Props.create(CreationActor.class),
        "creationActor");

    System.out.println("Started CreationSystem");
    final Random r = new Random();
    system.scheduler().schedule(Duration.create(1, SECONDS),
View Full Code Here

  }

  public static void startRemoteCalculatorSystem() {
    final ActorSystem system = ActorSystem.create("CalculatorSystem",
        ConfigFactory.load(("calculator")));
    system.actorOf(Props.create(CalculatorActor.class), "calculator");
    System.out.println("Started CalculatorSystem");
  }

  public static void startRemoteLookupSystem() {
View Full Code Here

  public static void startRemoteLookupSystem() {

    final ActorSystem system = ActorSystem.create("LookupSystem",
        ConfigFactory.load("remotelookup"));
    final String path = "akka.tcp://CalculatorSystem@127.0.0.1:2552/user/calculator";
    final ActorRef actor = system.actorOf(
        Props.create(LookupActor.class, path), "lookupActor");

    System.out.println("Started LookupSystem");
    final Random r = new Random();
    system.scheduler().schedule(Duration.create(1, SECONDS),
View Full Code Here

        "Factorials will start when 2 backend members in the cluster.");
    //#registerOnUp
    Cluster.get(system).registerOnMemberUp(new Runnable() {
      @Override
      public void run() {
        system.actorOf(Props.create(FactorialFrontend.class, upToN, true),
            "factorialFrontend");
      }
    });
    //#registerOnUp
  }
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.