Search in sources :

Example 21 with Props

use of akka.actor.Props in project chuidiang-ejemplos by chuidiang.

the class HelloActorMain method main.

public static void main(String[] args) {
    // an actor needs an ActorSystem
    ActorSystem system = ActorSystem.create("HelloWorldSystem");
    // create and start the actor
    Props actor = Props.create(HelloActor.class);
    ActorRef helloActor = system.actorOf(actor, "HelloActor");
    // send the actor two messages
    helloActor.tell("hello 1", helloActor);
    helloActor.tell("hello 2", helloActor);
    helloActor.tell("hello 3", helloActor);
    // shut down the system
    system.terminate();
}
Also used : ActorSystem(akka.actor.ActorSystem) ActorRef(akka.actor.ActorRef) Props(akka.actor.Props)

Aggregations

Props (akka.actor.Props)21 ActorRef (akka.actor.ActorRef)20 Test (org.junit.Test)13 FiniteDuration (scala.concurrent.duration.FiniteDuration)10 Timeout (akka.util.Timeout)8 Configuration (org.apache.flink.configuration.Configuration)8 ActorSystem (akka.actor.ActorSystem)7 UUID (java.util.UUID)7 TestingLeaderRetrievalService (org.apache.flink.runtime.leaderelection.TestingLeaderRetrievalService)7 JobClientMessages (org.apache.flink.runtime.messages.JobClientMessages)7 LeaderRetrievalService (org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService)4 AttachToJobAndWait (org.apache.flink.runtime.messages.JobClientMessages.AttachToJobAndWait)3 JavaTestKit (akka.testkit.JavaTestKit)2 ExecutorService (java.util.concurrent.ExecutorService)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2 GlobalConfiguration (org.apache.flink.configuration.GlobalConfiguration)2 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)2 BlobLibraryCacheManager (org.apache.flink.runtime.execution.librarycache.BlobLibraryCacheManager)2 JobManagerMessages (org.apache.flink.runtime.messages.JobManagerMessages)2 MetricRegistry (org.apache.flink.runtime.metrics.MetricRegistry)2