Package akka.actor

Examples of akka.actor.Props


  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(WorkerTaskA.class), "workerA");
    system.actorOf(new Props(WorkerTaskB.class), "workerB");
    system.actorOf(new Props(RouterActor.class), "router");
  }
View Full Code Here


  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem _system = ActorSystem.create("BroadcastRouterExample");
    ActorRef broadcastRouter = _system.actorOf(new Props(MsgEchoActor.class)
        .withRouter(new BroadcastRouter(5)),"myBroadcastRouterActor");

    for (int i = 1; i <= 2; i++) {
      //same message goes to all the actors
      broadcastRouter.tell(i);
View Full Code Here

  }

  @Test
  public void stopAndRestartTest() throws Exception {
    TestActorRef<SupervisorActor> supervisor = TestActorRef.apply(
        new Props(SupervisorActor.class), _system);
    ActorRef workerActor = supervisor.underlyingActor().getWorker();
    TestProbe probe = new TestProbe(_system);
    probe.watch(workerActor);
    supervisor.tell("10");
    probe.expectMsgClass(Terminated.class);
View Full Code Here

   * @param args
   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    ActorSystem _system = ActorSystem.create("RandomRouterExample");
    ActorRef randomRouter = _system.actorOf(new Props(MsgEchoActor.class)
        .withRouter(new RandomRouter(5)),"myRandomRouterActor");

    for (int i = 1; i <= 10; i++) {
      //sends randomly to actors
      randomRouter.tell(i);
View Full Code Here

   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    ActorSystem _system = ActorSystem
        .create("ScatterGatherFirstCompletedRouterExample");
    ActorRef scatterGatherFirstCompletedRouter = _system.actorOf(new Props(
        RandomTimeActor.class)
        .withRouter(new ScatterGatherFirstCompletedRouter(5, Duration
            .create(2, "seconds"))),
        "myScatterGatherFirstCompletedRouterActor");

View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(PushActor.class), "push");
    system.actorOf(new Props(PullActor1.class), "pull1");
    system.actorOf(new Props(PullActor2.class), "pull2");
  }
View Full Code Here

   * @param args
   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    ActorSystem _system = ActorSystem.create("RoundRobinRouterExample");
    ActorRef roundRobinRouter = _system.actorOf(new Props(
        MsgEchoActor.class).withRouter(new RoundRobinRouter(5)),"myRoundRobinRouterActor");

    for (int i = 1; i <= 10; i++) {
      //sends messages in a round robin way to all the actors
      roundRobinRouter.tell(i);
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    ActorSystem system = ActorSystem.create("zeromqTest");
    system.actorOf(new Props(WorkerTaskA.class), "workerA");
    system.actorOf(new Props(WorkerTaskB.class), "workerB");
    system.actorOf(new Props(PublisherActor.class), "publisher");
  }
View Full Code Here

  public void shutdown() {
    system.shutdown();
  }

  public void startup() {
    system.actorOf(new Props(RemoteActor.class), "remoteActor");
  }
View Full Code Here

  static ActorSystem _system = ActorSystem.create("TestSys", ConfigFactory
      .load().getConfig("TestSys"));

  @Test
  public void testOne() {
    TestActorRef<TickTock> actorRef = TestActorRef.apply(new Props(
        TickTock.class), _system);

    // get access to the underlying actor object
    TickTock actor = actorRef.underlyingActor();
    // access the methods the actor object and directly pass arguments and
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.