Page History
| Info |
|---|
멀티 플레이어 게임메시지 설계를 통해 AKKA-액터모델의 특징을 알아보겠습니다. 이 아티컬의 목표 : 여기서 진행되는 설계방식이 항상 권장되는 아키텍처는 아니며 웹소켓과 액터를 연결하여 심플한 멀티플레이어 웹게임서비스를 작성을 할수있는 메시지 중심의 최소한의 설계와 작동하는 최소한의 기능구현을 시도해보았습니다. |
웹소켓및 스프링 웹등은 메시지 기반의 멀티플레이어 게임을 만들기 위한 도구일뿐이며
...
AKKA의 액터를 이용한 버젼과, 전통적인 스레드를 사용하는 동일한 기능을 하는 두가지 버젼을 버전을 준비하였습니다.
스레드 버젼은 프로타잎용으로 먼저작성을 하였고, 이후 액터버젼으로 추가구현을 하였습니다.
두가지는 완전하게 같은 서버로직을 가지고 있으나 약간의 다른 메시지 패턴을 사용하였습니다.
스레드모델 VS 액터 모델
상용서비스 수준이 아닌 토이프로젝트이며 개선이 필요합니다.
- 스레드 모델 : https://github.com/psmon/gameweb/tree/master/src/main/java/com/vgw/demo/gameweb/thread
- 액터모델 : https://github.com/psmon/gameweb/tree/master/src/main/java/com/vgw/demo/gameweb/actor
- 전체 Code : https://github.com/psmon/gameweb
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
ActorSelection lobbyActor = system.ActorSelection("user/lobby");
lobbyActor.tell("some message",null);
// 자식의 모든 요소 선택이 가능합니다.
ActorSelection tableAllActor = system.ActorSelection("user/lobby/table/*");
tableAllActor.tell("some message",null); |
ActorPath를 통한 여러 지점에으로의 우아한 메시지 전송을 다음 링크를 통해 살펴볼수 있습니다.
...
웹소켓을 액터에 연결하기
| Include Page | ||||
|---|---|---|---|---|
|
유닛테스트
| Include Page | ||||
|---|---|---|---|---|
|
샘플데모
기타 유용한링크
- https://getakka.net/articles/intro/what-are-actors.html
- https://doc.akka.io/docs/akka/2.5/general/addressing.html - Actor Path
- https://www.baeldung.com/akka-with-spring
기타 참고자료
또한 메시지 처리에서 Thread와 Actor를 비교해보는것은 , 메시징 처리를 위한 좋은 학습자료가 될것입니다.
- https://getakka.net/articles/intro/what-are-actors.html
- http://alexminnaar.com/introduction-to-the-multithreading-problem-and-the-akka-actor-solution.html
