protected override bool ReceiveCommand(object message)
 {
     if (message == "print")
         Console.WriteLine("Current actor's state: " + State);
     else if (message == "snap")
         SaveSnapshot(State);
     else if (message is SaveSnapshotFailure || message is SaveSnapshotSuccess) { }
     else if (message is string)
         Persist(message.ToString(), evt => State = State.Update(new Event(evt)));
     else return false;
     return true;
 }
 protected override bool ReceiveRecover(object message)
 {
     if (message is SnapshotOffer)
     {
         var s = ((SnapshotOffer) message).Snapshot as ExampleState;
         Console.WriteLine("Offered state (from snapshot): " + s);
         State = s;
     }
     else if (message is string)
         State = State.Update(new Event(message.ToString()));
     else return false;
     return true;
 }
Beispiel #3
0
 protected override bool ReceiveRecover(object message)
 {
     if (message is SnapshotOffer)
     {
         var s = ((SnapshotOffer)message).Snapshot as ExampleState;
         ServiceEventSource.Current.Message("Offered state (from snapshot): " + s);
         State = s;
     }
     else if (message is string)
     {
         State = State.Update(new Event(message.ToString()));
     }
     else
     {
         return(false);
     }
     return(true);
 }
Beispiel #4
0
 protected override bool ReceiveCommand(object message)
 {
     if (message as string == "print")
     {
         ServiceEventSource.Current.Message("Current actor's state: " + State);
     }
     else if (message as string == "snap")
     {
         SaveSnapshot(State);
     }
     else if (message is SaveSnapshotFailure || message is SaveSnapshotSuccess)
     {
     }
     else if (message is string)
     {
         Persist(message.ToString(), evt => State = State.Update(new Event(evt)));
     }
     else
     {
         return(false);
     }
     return(true);
 }
 public SnapshotedExampleActor()
 {
     State = new ExampleState();
 }
Beispiel #6
0
 public ExamplePersistentActor()
 {
     State = new ExampleState();
 }
Beispiel #7
0
 public SnapshotedExampleActor()
 {
     State = new ExampleState();
 }
 public ExamplePersistentActor()
 {
     State = new ExampleState();
 }