public PullResponse Pull(PullRequest request) { //TODO: Check URI PullSubscription subsciption; if (request.EnumerationContext == null || !_subscriptions.TryGetValue(request.EnumerationContext.Text, out subsciption)) { throw Faults.InvalidEnumerationContext.Create(); } EnumerationModeExtension.Activate(EnumerationMode.EnumerateObjectAndEPR, subsciption.EventType); int maxElements = request.MaxElements != null ? request.MaxElements.Value : 1; TimeSpan maxTime = request.MaxTime != null ? request.MaxTime.Value : TimeSpan.FromSeconds(10); EnumerationItemList items = new EnumerationItemList(PullItems(subsciption.Buffer.FetchNotifications(maxElements, maxTime))); //R7.2.13-5 if (items.Items.Count() == 0) { throw Faults.TimedOut.Create(); } return new PullResponse { Items = items, EndOfSequence = null, EnumerationContext = request.EnumerationContext }; }
public PullResponse Pull(PullRequest request) { EnumerationState holder; if (!_activeEnumerations.TryGetValue(request.EnumerationContext, out holder)) { throw Faults.InvalidEnumerationContext.Create(); } int maxElements = request.MaxElements != null ? request.MaxElements.Value : 1; bool endOfSequence; EnumerationItemList items = new EnumerationItemList(PullItems(maxElements, holder.Mode, holder.Enumerator, out endOfSequence)); if (endOfSequence) { _activeEnumerations.Remove(request.EnumerationContext); } return new PullResponse { Items = items, EndOfSequence = endOfSequence ? new EndOfSequence() : null, EnumerationContext = endOfSequence ? null : request.EnumerationContext }; }
public PullResponse Pull(PullRequest request) { //TODO: Check expiration and fault if expired. return _pullDeliveryServer.Pull(request); }