Versions Compared

Key

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

작성중 컨텐츠...


이미 설계되어 잘작동하는 복합구성 액터모델

작성된 액터기능

  • 일반 사용자가 접속하면 PersnalRoom이라는 개인룸의 액터를 받게되어 개인전용 실시간 처리 공간이 생성됩니다.
  • 상담원을 관리하는 메니저가 있으며 메니저는 개인사용자가 상담을 요청하면 가용 상담원을 찾은후 상담방을 생성합니다.
  • 상담방이 생성되면 요청한 개인과 상담원을 연결합니다.

AI에 의해 추가할기능 

  • 상담방에 옵저버 기능을 만들어 상담원을 초청합니다.
  • 옵저버 상담원은 상담진행을 개입을 못하며 관찰할수 있습니다.
  • typed actor를 사용하는 경우 이벤트의 상관관계를 InteliJ다이어그램을 통해 파악가능합니다.
    • untyped actor인 경우 컴파일타임 안전하지 못한 단점이 있었지만, akka 2.6x부터 typed 액터를 지원합니다.

핵심 포인트

  • 소켓세션을 n개 만드는것이 아닌, 사용자는 1개의 소켓세션만 이용 n개의 채널을 이용가능
  • n개의 세션 액터로 논리개념을 만들어 기능을 확장

...

Code Block
themeEmacs
    @Test
    fun testAddObserverCounselor() {
        val probe = testKit.createTestProbe<CounselorManagerResponse>()
        val counselorManager = testKit.spawn(CounselorManagerActor.create())

        // Create a counselor and a room
        counselorManager.tell(CreateCounselor("observer1", probe.ref))
        probe.receiveMessage()
        counselorManager.tell(CreateRoom("room1", probe.ref))
        probe.receiveMessage()

        // Add observer counselor to the room
        counselorManager.tell(AddObserverCounselor("room1", "observer1", probe.ref))
        val response = probe.receiveMessage()
        assertEquals(CounselorManagerSystemResponse("Observer counselor observer1 added to room: room1"), response)
    }



AI가 작성한 코드 유닛테스트로 검증




유닛테스트가 작작동함으로 개선사항 커밋



연구 저장소 : https://github.com/psmon/kopring-reactive-labs

...