protected override IEnumerator <IAsyncResult> PeekMessagesImpl(IAccountIdentifier identity, string account, string queue, int numMessages, TimeSpan?timeout, RequestContext requestContext, AsyncIteratorContext <IEnumerable <PeekedMessage> > context) { this.ValidateNumMessages(numMessages, this.config.MaxMessagesToReturn); RemainingTime remainingTime = new RemainingTime(timeout); SASAuthorizationParameters sASAuthorizationParameter = new SASAuthorizationParameters() { SupportedSasTypes = SasType.ResourceSas | SasType.AccountSas, SignedResourceType = SasResourceType.Object, SignedPermission = SASPermission.Read }; SASAuthorizationParameters sASAuthorizationParameter1 = sASAuthorizationParameter; IAsyncResult asyncResult = this.BeginGetQueue(identity, account, queue, PermissionLevel.Read, sASAuthorizationParameter1, remainingTime, requestContext, context.GetResumeCallback(), context.GetResumeState("QueueManager.PeekMessagesImpl")); yield return(asyncResult); IQueueContainer operationStatus = this.EndGetQueue(asyncResult); if (requestContext != null) { operationStatus.OperationStatus = requestContext.OperationStatus; } operationStatus.Timeout = remainingTime; asyncResult = operationStatus.BeginPeekMessage(numMessages, context.GetResumeCallback(), context.GetResumeState("QueueManager.PeekMessagesImpl")); yield return(asyncResult); IEnumerable <IMessageData> messageDatas = operationStatus.EndPeekMessage(asyncResult); context.ResultData = this.WrapPeekedMessageResults(messageDatas); }