Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEmacs
fun main() {
    val system = ActorSystem.create("RoundRobinSystem")

    // RoundRobinPool로 HelloActor 3개 구성
    val router = system.actorOf(
        RoundRobinPool(3).props(HelloActor.props()),
        "helloRouter"
    )

    println("=== 메시지 전송 시작 ===")
    for (i in 1..9) {
        val future = Patterns.ask(router, "hello $i", 1000)
        val result = Await.result(future, Duration.create(1, TimeUnit.SECONDS))
        println("응답 $i: $result")
    }

    system.terminate()
}

// Output
[helloRouter/$a] received: hello 1
응답 1: world
[helloRouter/$b] received: hello 2
응답 2: world
[helloRouter/$c] received: hello 3
응답 3: world
[helloRouter/$a] received: hello 4
응답 4: world
...



테스트 가능한 다양한 액터 장치들

Info

테스트 코드를 통해 작동방법을 설명하고 수행합니다.

액터모델을 통해 다양한 장치를 이용해 작동하는 유용한 샘플코드를 살펴볼수 있습니다.


Image Added



액터프로그래밍 활용사례

1. Scala: Akka 프레임워크

...