Пример #1
0
        private bool Initializing(object message)
        {
            switch (message)
            {
            case CurrentPersistenceIds current:
                _lastOrderingOffset = current.HighestOrderingNumber;
                _buffer.AddRange(current.AllPersistenceIds);
                _buffer.DeliverBuffer(TotalDemand);

                Become(Active);
                Stash.UnstashAll();
                return(true);

            case Continue _:
                return(true);

            case Cancel _:
                Context.Stop(Self);
                return(true);

            default:
                Stash.Stash();
                return(true);
            }
        }
Пример #2
0
        private bool Initializing(object message)
        {
            switch (message)
            {
            case CurrentPersistenceIds current:
                _buffer.AddRange(current.AllPersistenceIds);
                _buffer.DeliverBuffer(TotalDemand);

                if (_buffer.IsEmpty)
                {
                    OnCompleteThenStop();
                    return(true);
                }

                Become(Active);
                Stash.UnstashAll();
                return(true);

            case Cancel _:
                Context.Stop(Self);
                return(true);

            default:
                Stash.Stash();
                return(true);
            }
        }
Пример #3
0
        private bool Active(object message) => message.Match()
        .With <CurrentPersistenceIds>(current => {
            _buffer.AddRange(current.AllPersistenceIds);
            _buffer.DeliverBuffer(TotalDemand);

            if (!_liveQuery && _buffer.IsEmpty)
            {
                OnCompleteThenStop();
            }
        })
        .With <PersistenceIdAdded>(added => {
            if (_liveQuery)
            {
                _buffer.Add(added.PersistenceId);
                _buffer.DeliverBuffer(TotalDemand);
            }
        })
        .With <Request>(_ => {
            _buffer.DeliverBuffer(TotalDemand);
            if (!_liveQuery && _buffer.IsEmpty)
            {
                OnCompleteThenStop();
            }
        })
        .With <Cancel>(_ => Context.Stop(Self))
        .WasHandled;