コード例 #1
0
        protected override IEnumerator <IAsyncResult> GetQueuePropertiesImpl(IAccountIdentifier identity, string account, string queue, bool getMessageCount, SASAuthorizationParameters sasParams, TimeSpan?timeout, RequestContext requestContext, AsyncIteratorContext <QueueProperties> context)
        {
            RemainingTime remainingTime = new RemainingTime(timeout);
            IAsyncResult  asyncResult   = this.BeginGetQueue(identity, account, queue, PermissionLevel.Read, sasParams, ContainerPropertyNames.ApplicationMetadata, remainingTime, requestContext, context.GetResumeCallback(), context.GetResumeState("QueueManager.GetQueuePropertiesImpl"));

            yield return(asyncResult);

            IQueueContainer operationStatus = this.EndGetQueue(asyncResult);

            if (requestContext != null)
            {
                operationStatus.OperationStatus = requestContext.OperationStatus;
            }
            NameValueCollection nameValueCollection = QueueHelpers.DeserializeMetadata(operationStatus.ApplicationMetadata);
            long?nullable = null;

            if (getMessageCount)
            {
                operationStatus.Timeout = remainingTime;
                asyncResult             = operationStatus.BeginGetQueueStatistics(true, true, context.GetResumeCallback(), context.GetResumeState("QueueManager.GetQueuePropertiesImpl"));
                yield return(asyncResult);

                nullable = new long?(operationStatus.EndGetQueueStatistics(asyncResult).TotalMessages);
            }
            context.ResultData = new QueueProperties(account, queue, nullable, nameValueCollection);
        }