blatt01/src/main/java/com/example/AkkaQuickstart.java
2024-04-19 15:52:01 +02:00

26 lines
670 B
Java

package com.example;
import akka.actor.typed.ActorSystem;
import java.io.IOException;
public class AkkaQuickstart {
public static void main(String[] args) {
//#actor-system
final ActorSystem<GreeterMain.SayHello> greeterMain = ActorSystem.create(GreeterMain.create(), "helloakka");
//#actor-system
//#main-send-messages
greeterMain.tell(new GreeterMain.SayHello("Charles"));
greeterMain.tell(new GreeterMain.SayHello("Alice"));
//#main-send-messages
try {
System.out.println(">>> Press ENTER to exit <<<");
System.in.read();
} catch (IOException ignored) {
} finally {
greeterMain.terminate();
}
}
}