Пример #1
0
        protected override IEnumerator <IAsyncResult> UpdateMessageImpl(IAccountIdentifier identity, string account, string queue, string messageId, byte[] popReceipt, byte[] body, TimeSpan visibilityTimeout, TimeSpan?timeout, RequestContext requestContext, AsyncIteratorContext <PoppedMessage> context)
        {
            Guid          guid;
            RemainingTime remainingTime = new RemainingTime(timeout);
            SASAuthorizationParameters sASAuthorizationParameter = new SASAuthorizationParameters()
            {
                SupportedSasTypes  = SasType.ResourceSas | SasType.AccountSas,
                SignedResourceType = SasResourceType.Object,
                SignedPermission   = SASPermission.Update
            };
            SASAuthorizationParameters sASAuthorizationParameter1 = sASAuthorizationParameter;
            IAsyncResult asyncResult = this.BeginGetQueue(identity, account, queue, PermissionLevel.Write, sASAuthorizationParameter1, remainingTime, requestContext, context.GetResumeCallback(), context.GetResumeState("QueueManager.UpdateMessageImpl"));

            yield return(asyncResult);

            IQueueContainer operationStatus = this.EndGetQueue(asyncResult);

            if (requestContext != null)
            {
                operationStatus.OperationStatus = requestContext.OperationStatus;
            }
            operationStatus.Timeout = remainingTime;
            try
            {
                guid = new Guid(messageId);
            }
            catch (Exception exception)
            {
                throw new MessageNotFoundException("Invalid message name", exception);
            }
            IQueueMessageReceipt queueMessageReceipt = this.DecodeReceipt(popReceipt, guid);
            TimeSpan?            nullable            = null;

            asyncResult = operationStatus.BeginUpdateMessage(queueMessageReceipt, body, visibilityTimeout, nullable, context.GetResumeCallback(), context.GetResumeState("QueueManager.UpdateMessageImpl"));
            yield return(asyncResult);

            IQueueMessageReceipt queueMessageReceipt1 = operationStatus.EndUpdateMessage(asyncResult);

            context.ResultData = this.GetPoppedMessageInfoFromReceipt(queueMessageReceipt1);
        }