Esempio n. 1
0
        private void ApplyEvent(Event @event)
        {
            switch (@event)
            {
            case RecoverEvent msg:
                if (msg.Data is RenameEvent re)
                {
                    _state.Name = re.Name;
                    Console.WriteLine("MyPersistenceActor - RecoverEvent = Event.Index = {0}, Event.Data = {1}", msg.Index, msg.Data);
                }
                break;

            case ReplayEvent msg:
                if (msg.Data is RenameEvent rp)
                {
                    _state.Name = rp.Name;
                    Console.WriteLine("MyPersistenceActor - ReplayEvent = Event.Index = {0}, Event.Data = {1}", msg.Index, msg.Data);
                }
                break;

            case PersistedEvent msg:
                Console.WriteLine("MyPersistenceActor - PersistedEvent = Event.Index = {0}, Event.Data = {1}", msg.Index, msg.Data);
                break;
            }
        }
 private void ApplyEvent(Proto.Persistence.Event @event)
 {
     switch (@event.Data)
     {
     case Added msg:
         _value = _value + msg.Amount;
         break;
     }
 }
 private void ApplyEvent(Event @event)
 {
     switch (@event.Data)
     {
     case SampleDto msg:
         QueueDto.Add(msg);
         Logger.LogInformation("Restore Queue : {0}", string.Join(",", QueueDto.Select(x => x.Number)));
         break;
     }
 }
Esempio n. 4
0
 private void ApplyEvent(Proto.Persistence.Event @event)
 {
     switch (@event.Data)
     {
     case Data msg:
         _value = _value + msg.Amount;
         Console.WriteLine($"事件溯源累计:{_value}");
         break;
     }
 }
Esempio n. 5
0
 private void ApplyEvent(Proto.Persistence.Event @event)
 {
     switch (@event.Data)
     {
     case HelloRequest req:
         Handle(req);
         //处理成功后删除保存的状态
         _persistence.DeleteEventsAsync(2);
         break;
     }
 }