Package akka.actor

Examples of akka.actor.ActorSystem.actorOf()


      withFallback(ConfigFactory.parseString("akka.cluster.roles = [backend]")).
      withFallback(ConfigFactory.load("factorial"));

    ActorSystem system = ActorSystem.create("ClusterSystem", config);

    system.actorOf(Props.create(FactorialBackend.class), "factorialBackend");

    system.actorOf(Props.create(MetricsListener.class), "metricsListener");

  }
View Full Code Here


    ActorSystem system = ActorSystem.create("ClusterSystem", config);

    system.actorOf(Props.create(FactorialBackend.class), "factorialBackend");

    system.actorOf(Props.create(MetricsListener.class), "metricsListener");

  }

}
View Full Code Here

public class LoggingDocTest {
 
  @Test
  public void useLoggingActor() {
    ActorSystem system = ActorSystem.create("MySystem");
    ActorRef myActor = system.actorOf(Props.create(MyActor.class, this));
    myActor.tell("test", ActorRef.noSender());
    JavaTestKit.shutdownActorSystem(system);
  }

  @Test
View Full Code Here

  }

  @Test
  public void useLoggingActorWithMDC() {
    ActorSystem system = ActorSystem.create("MyDiagnosticSystem");
    ActorRef mdcActor = system.actorOf(Props.create(MdcActor.class, this));
    mdcActor.tell("some request", ActorRef.noSender());
    JavaTestKit.shutdownActorSystem(system);
  }

  @Test
View Full Code Here

  @Test
  public void subscribeToDeadLetters() {
    //#deadletters
    final ActorSystem system = ActorSystem.create("DeadLetters");
    final ActorRef actor = system.actorOf(Props.create(DeadLetterActor.class));
    system.eventStream().subscribe(actor, DeadLetter.class);
    //#deadletters
    JavaTestKit.shutdownActorSystem(system);
  }
 
View Full Code Here

public class ProducerTestBase {
  public void tellJmsProducer() {
    //#TellProducer
    ActorSystem system = ActorSystem.create("some-system");
    Props props = Props.create(Orders.class);
    ActorRef producer = system.actorOf(props, "jmsproducer");
    producer.tell("<order amount=\"100\" currency=\"PLN\" itemId=\"12345\"/>",
        ActorRef.noSender());
    //#TellProducer
    JavaTestKit.shutdownActorSystem(system);
  }
View Full Code Here

  @SuppressWarnings("unused")
  public void askProducer() {
    //#AskProducer
    ActorSystem system = ActorSystem.create("some-system");
    Props props = Props.create(FirstProducer.class);
    ActorRef producer = system.actorOf(props,"myproducer");
    Future<Object> future = Patterns.ask(producer, "some request", 1000);
    //#AskProducer
    system.stop(producer);
    JavaTestKit.shutdownActorSystem(system);
  }
View Full Code Here

  public void correlate(){
    //#Correlate
    ActorSystem system = ActorSystem.create("some-system");
    Props props = Props.create(Orders.class);
    ActorRef producer = system.actorOf(props,"jmsproducer");
    Map<String,Object> headers = new HashMap<String, Object>();
    headers.put(CamelMessage.MessageExchangeId(),"123");
    producer.tell(new CamelMessage("<order amount=\"100\" currency=\"PLN\" " +
      "itemId=\"12345\"/>",headers), ActorRef.noSender());
    //#Correlate
View Full Code Here

      configuration = config;
      ofEventHandlerClass = handler;
     
      final ActorSystem system = ActorSystem.create("OfController");
      final ActorRef manager = Tcp.get(system).manager();
      controller = system.actorOf(Props.create(Controller.class, manager), "Controller-Dispatcher");

      return ControllerRef.create(controller);
   }
  
  /**
 
View Full Code Here

      configuration = new Configuration();
      ofEventHandlerClass = handler;
     
      final ActorSystem system = ActorSystem.create("OfController");
      final ActorRef manager = Tcp.get(system).manager();
      controller = system.actorOf(Props.create(Controller.class, manager), "Controller-Dispatcher");
     
      return ControllerRef.create(controller);
   }
  
   public static class ControllerRef {
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.