Akka.Persistence.Tests.PersistentActorSpec.NestedPersistInAsyncEnforcesStashing.ReceiveCommand C# (CSharp) Method

ReceiveCommand() protected method

protected ReceiveCommand ( object message ) : bool
message object
return bool
            protected override bool ReceiveCommand(object message)
            {
                if (message is string)
                {
                    var s = (string) message;
                    _probe.Tell(s);
                    PersistAsync(s + "-outer-async", outer =>
                    {
                        _probe.Tell(outer);
                        Persist(s + "-inner", inner =>
                        {
                            _probe.Tell(inner);
                            Thread.Sleep(1000); // really long wait here
                            // the next incoming command must be handled by the following function
                            Context.Become(_ =>
                            {
                                Sender.Tell("done");
                                return true;
                            });
                        });
                    });
                    return true;
                }
                return false;
            }
        }
PersistentActorSpec.NestedPersistInAsyncEnforcesStashing