Dışarıya aktar (0) Yazdır
Tümünü Genişlet
EN
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

Update Message

Updated: September 13, 2011

This operation was introduced with version 2011-08-18 of the Queue service API. The Update Message operation updates the visibility timeout of a message. You can also use this operation to update the contents of a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in size.

The Update Message request may be constructed as follows. HTTPS is recommended. Replace myaccount with the name of your storage account, and myqueue with the name of your queue:

 

Method Request URI HTTP Version

PUT

https://myaccount.queue.core.windows.net/myqueue/messages/messageid?popreceipt=<string-value>&visibilitytimeout=<int-seconds>

HTTP/1.1

This operation is supported for SDK 1.6 and newer versions.

When making a request against the emulated storage service, specify the emulator hostname and Queue service port as 127.0.0.1:10001, followed by the emulated storage account name:

 

Method Request URI HTTP Version

PUT

http://127.0.0.1:10001/devstoreaccount1/myqueue/messages/messageid?popreceipt=<string-value>&visibilitytimeout=<int-seconds>

HTTP/1.1

For more information, see About Development Storage.

The following parameters may be specified on the request URI.

 

Parameter Description

popreceipt

Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.

visibilitytimeout

Required. Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. A message can be updated until it has been deleted or has expired.

timeout

Optional. The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Queue Service Operations.

The following table describes required and optional request headers.

 

Request Header Description

Authorization

Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage Services.

Date or x-ms-date

Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication for the Azure Storage Services.

x-ms-version

Requires 2011-08-18 or newer. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage Services.

x-ms-client-request-id

Optional. Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. Using this header is highly recommended for correlating client-side activities with requests received by the server. For more information, see About Storage Analytics Logging and Windows Azure Logging: Using Logs to Track Storage Requests.

The body of the request contains the message data in the following XML format. Note that the message content must be in a format that may be encoded with UTF-8.

<QueueMessage>
    <MessageText>message-content</MessageText>
</QueueMessage>

The response includes an HTTP status code and a set of response headers.

A successful operation returns status code 204 (No Content).

For information about status codes, see Status and Error Codes.

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

 

Request Header Description

x-ms-request-id

This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations.

x-ms-version

Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and later.

Date

A UTC date/time value generated by the service that indicates the time at which the response was initiated.

x-ms-popreceipt

The pop receipt of the queue message.

x-ms-time-next-visible

A UTC date/time value that represents when the message will be visible on the queue.

This operation can be performed by the account owner and by anyone with a shared access signature that has permission to perform this operation.

The following request extends the visibility of a queue message by 30 seconds and updates its content.

PUT https://myaccount.queue.core.windows.net/myqueue/messages/663d89aa-d1d9-42a2-9a6a-fcf822a97d2c?popreceipt=AgAAAAEAAAApAAAAGIw6Q29bzAE%3d&visibilitytimeout=30&timeout=30 HTTP/1.1

The request is sent with the following headers:

x-ms-version: 2011-08-18
x-ms-date: Mon, 29 Aug 2011 17:17:21 GMT
Authorization: SharedKey myaccount:batcrWZ35InGCZeTUFWMdIQiOZPCW7UEyeGdDOg7WW4=
Content-Length: 75

The request is sent with the following XML body:

<QueueMessage>
    <MessageText>new-message-content</MessageText>
</QueueMessage>

After the request has been sent, the following response is returned:

HTTP/1.1 204 No Content
Content-Length: 0
Server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: df34a7dd-3cbe-4206-a586-d6de3cf225a7
x-ms-version: 2011-08-18
x-ms-popreceipt: AwAAAAIAAAApAAAAINtMQ29bzAEBAAAA
x-ms-time-next-visible: Mon, 29 Aug 2011 17:17:51 GMT
Date: Mon, 29 Aug 2011 17:17:21 GMT

An Update Message operation will fail if the specified message does not exist in the queue, or if the specified pop receipt does not match the message.

A pop receipt is returned by the Get Messages operation or the Update Message operation. Pop receipts remain valid until one of the following events occurs:

  1. The message has expired.

  2. The message has been deleted using the last pop receipt received either from Get Messages or Update Message.

  3. The invisibility time has elapsed and the message has been dequeued by a Get Messages request. When the invisibility time elapses, the message becomes visible again. If it is retrieved by another Get Messages request, the returned pop receipt can be used to delete or update the message.

  4. The message has been updated with a new visibility timeout. When the message is updated, a new pop receipt will be returned.

The Update Message operation can be used to continually extend the invisibility of a queue message. This functionality can be useful if you want a worker role to “lease” a queue message. For example, if a worker role calls Get Messages and recognizes that it needs more time to process a message, it can continually extend the message’s invisibility until it is processed. If the worker role were to fail during processing, eventually the message would become visible again and another worker role could process it.

Show:
© 2014 Microsoft