Versions Compared

Key

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

...

Expand
titleresult

[DEBUG][2017-09-24 오후 1:59:13][Thread 0009][EventStream(ServiceA)] Logger log1-DefaultLogger [DefaultLogger] started
[DEBUG][2017-09-24 오후 1:59:13][Thread 0009][EventStream(ServiceA)] StandardOutLogger being removed
[DEBUG][2017-09-24 오후 1:59:13][Thread 0009][EventStream(ServiceA)] Default Loggers started
[INFO][2017-09-24 오후 1:59:13][Thread 0009][remoting] Starting remoting
[DEBUG][2017-09-24 오후 1:59:13][Thread 0015][remoting] Starting prune timer for endpoint manager...
[INFO][2017-09-24 오후 1:59:13][Thread 0009][remoting] Remoting started; listening on addresses : [akka.tcp://ServiceA@127.0.0.1:8001]
[INFO][2017-09-24 오후 1:59:13][Thread 0009][remoting] Remoting now listens on addresses: [akka.tcp://ServiceA@127.0.0.1:8001]
[WARNING][2017-09-24 오후 1:59:13][Thread 0009][ActorSystem(ServiceA)] NewtonSoftJsonSerializer has been detected as a default serializer. It will be obsoleted in Akka.NET starting from version 1.5 in the favor of Hyperion (for more info visit: http://getakka.net/docs/Serialization#how-to-setup-hyperion-as-default-serializer ). If you want to suppress this message set HOCON `akka.suppress-json-serializer-warning` config flag to on.
WaitforTest:1000
Try print
장바구니에 처음 담은 물건을뺌-4-3, 장바구니에 물건을 또담음-3-2, 장바구니에 물건을 담음-2-1, 장바구니를 물건을 담음-1-0
WaitforTest:1000
[ERROR][2017-09-24 오후 1:59:14][Thread 0010][akka://ServiceA/user/myActor] Kill
Cause: Akka.Actor.ActorKilledException: Kill
위치: Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
위치: Akka.Actor.ActorCell.Invoke(Envelope envelope)
Try print - 여기서 액터의 이벤트가 복구됨을 확인할수 있습니다.
장바구니에 처음 담은 물건을뺌-4-3, 장바구니에 물건을 또담음-3-2, 장바구니에 물건을 담음-2-1, 장바구니를 물건을 담음-1-0


주요 체크 Point

  • 메시지 설계는 명령(cmd)와 발생하는 이벤트(evt) 를 분리하여 설계합니다.
  • UntypedPersistentActor 를 상속받아서 자신만의 PersitentActor를 설계합니다.

  • OnCommand 에서 메시지 처리기를 설계합니다.

    • 명령과 관련있는 이벤트를 저장합니다.  Persist(new Evt($"{cmd.Data}-{NumEvents}"), UpdateState)

  • override Recovery Recovery 를 통해 복구기를 지정합니다.
  • protected override void OnRecover 를 통해 복구가 일어날때의 코드를 재정의합니다.
  • EventList 는 ImmutableList를 사용하여, 업데이트 될시 Event를 추가만 하면됩니다.



 위 설계 코드를 테스트하는 코드는 간단합니다. 우리는 어떠한 커멘드를 비 동기로 보내고, 

...