コード例 #1
0
        public void Handle(ClientMessage.ReadEventsFromTFCompleted message)
        {
            EventDistributionPoint distributionPoint;

            if (_distributionPoints.TryGetValue(message.CorrelationId, out distributionPoint))
            {
                distributionPoint.Handle(message);
            }
        }
コード例 #2
0
        public override void Handle(ClientMessage.ReadEventsFromTFCompleted message)
        {
            if (_disposed)
            {
                return;
            }
            if (!_eventsRequested)
            {
                throw new InvalidOperationException("Read events has not been requested");
            }
            if (_paused)
            {
                throw new InvalidOperationException("Paused");
            }
            _eventsRequested = false;
            switch (message.Result)
            {
            case RangeReadResult.NoStream:
                throw new NotSupportedException("ReadEventsFromTF should not return NoStream");

            case RangeReadResult.Success:
                if (message.Events.Length == 0)
                {
                    // the end
                    DeliverLastCommitPosition(_from.CommitPosition);
                    // allow joining heading distribution
                }
                else
                {
                    for (int index = 0; index < message.Events.Length; index++)
                    {
                        var @event = message.Events[index];
                        DeliverEvent(@event);
                    }
                }
                if (_pauseRequested)
                {
                    _paused = true;
                }
                else
                {
                    //TODO: we may publish this message somewhere 10 events before the end of the chunk
                    _publisher.Publish(
                        new ProjectionMessage.CoreService.Tick(
                            () => { if (!_paused && !_disposed)
                                    {
                                        RequestEvents();
                                    }
                            }));
                }
                break;

            default:
                throw new NotSupportedException(
                          string.Format("ReadEvents result code was not recognized. Code: {0}", message.Result));
            }
        }
コード例 #3
0
 public abstract void Handle(ClientMessage.ReadEventsFromTFCompleted message);
コード例 #4
0
 public override void Handle(ClientMessage.ReadEventsFromTFCompleted message)
 {
     throw new NotImplementedException();
 }