コード例 #1
0
        public async Task UpdateMessageAsync(AzureQueueMessage message)
        {
            if (!(message is T))
            {
                throw new ArgumentException("Message should be instance of T", nameof(message));
            }

            var messageRef = message.GetMessageReference();

            if (messageRef == null)
            {
                throw new ArgumentException("Message reference cannot be null", nameof(messageRef));
            }

            messageRef.SetMessageContent(GetSerializedMessage((T)message));
            await this.queue.UpdateMessageAsync(messageRef, this.visibilityTimeout,
                                                MessageUpdateFields.Visibility | MessageUpdateFields.Content).ConfigureAwait(false);
        }
コード例 #2
0
        public void UpdateMessage(AzureQueueMessage message)
        {
            if (!(message is T))
            {
                throw new ArgumentException("Message should be instance of T", "message");
            }

            var messageRef = message.GetMessageReference();

            if (messageRef == null)
            {
                throw new ArgumentException("Message reference cannot be null", "message.GetMessageReference()");
            }

            this.StorageRetryPolicy.ExecuteAction(() =>
            {
                messageRef.SetMessageContent(GetSerializedMessage(message as T));
                this.queue.UpdateMessage(messageRef, this.visibilityTimeout, MessageUpdateFields.Visibility | MessageUpdateFields.Content);
            });
        }