コード例 #1
0
        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");
                });
            });
        }
コード例 #2
0
 public PersistentActorRecoveryTimeoutSpec()
     : base(SteppingMemoryJournal.Config(JournalId).WithFallback(
                ConfigurationFactory.ParseString(
                    @"akka.persistence.journal.stepping-inmem.recovery-event-timeout = 1s
             akka.actor.serialize-messages = off"))
            .WithFallback(Configuration("PersistentActorRecoveryTimeoutSpec")))
 {
     // initialize journal early
     Persistence.Instance.Apply(Sys).JournalFor("akka.persistence.journal.stepping-inmem");
     AwaitAssert(() => SteppingMemoryJournal.GetRef(JournalId), TimeSpan.FromSeconds(3));
     _journal = SteppingMemoryJournal.GetRef(JournalId);
 }