public void The_recovery_timeout_should_not_interfere_with_receive_timeout() { var timeout = TimeSpan.FromDays(42); var probe = CreateTestProbe(); var persisting = Sys.ActorOf(Props.Create(() => new ReceiveTimeoutActor(timeout, probe.Ref))); // initial read highest SteppingMemoryJournal.Step(_journal); persisting.Tell("A"); SteppingMemoryJournal.Step(_journal); ExpectMsg("A"); Watch(persisting); Sys.Stop(persisting); ExpectTerminated(persisting); // now replay, but don't give the journal any tokens to replay events // so that we cause the timeout to trigger var replaying = Sys.ActorOf(Props.Create(() => new ReceiveTimeoutActor(timeout, probe.Ref))); Watch(replaying); // initial read highest SteppingMemoryJournal.Step(_journal); // read journal SteppingMemoryJournal.Step(_journal); // we should get initial receive timeout back from actor when replay completes probe.ExpectMsg(timeout); }
public void Stashing_in_a_PersistentActor_mixed_with_PersistAsync_should_handle_async_callback_not_happening_until_next_message_has_been_stashed_within_handler() { var pref = Sys.ActorOf(Props.Create(() => new AsyncStashingWithinHandlerActor(Name))); AwaitAssert(() => SteppingMemoryJournal.GetRef("persistence-stash"), TimeSpan.FromSeconds(3)); var journal = SteppingMemoryJournal.GetRef("persistence-stash"); // initial read highest SteppingMemoryJournal.Step(journal); pref.Tell(new Cmd("a")); pref.Tell(new Cmd("b")); // allow the write to complete, after the stash SteppingMemoryJournal.Step(journal); pref.Tell(new Cmd("c")); // writing of c and b SteppingMemoryJournal.Step(journal); SteppingMemoryJournal.Step(journal); Within(TimeSpan.FromSeconds(3), () => { AwaitAssert(() => { pref.Tell(GetState.Instance); ExpectMsgInOrder("a", "c", "b"); }); }); }
public void The_recovery_timeout_should_fail_recovery_if_timeout_is_not_met_when_recovering() { var probe = CreateTestProbe(); var persisting = Sys.ActorOf(Props.Create(() => new RecoveryTimeoutActor(probe.Ref))); // initial read highest SteppingMemoryJournal.Step(_journal); persisting.Tell("A"); SteppingMemoryJournal.Step(_journal); ExpectMsg("A"); Watch(persisting); Sys.Stop(persisting); ExpectTerminated(persisting); // now replay, but don't give the journal any tokens to replay events // so that we cause the timeout to trigger var replaying = Sys.ActorOf(Props.Create(() => new RecoveryTimeoutActor(probe.Ref))); Watch(replaying); // initial read highest SteppingMemoryJournal.Step(_journal); probe.ExpectMsg <Status.Failure>().Cause.GetType().ShouldBe(typeof(RecoveryTimedOutException)); ExpectTerminated(replaying); }