The PUT action on a MessageQueue endpoint does one of two things:
Sends a message to the specified queue
or
Sets the visibility timeout for the specified queue (see SetVisibilityTimeout for more information about this setting)
To send a message, you must append the static message ID back to the queue URL (see the example below). The message is sent to the back of the queue, as messages are read from the front of the queue. You specify the content of the message in the Message parameter, and the content can be any string. The total string length of Message cannot exceed 256K.
To set the visibility timeout, you must include the VisibilityTimeout parameter, but you must not append the static message ID back to the queue URL. If you do, the request will succeed, but the visibility timeout will not be set.
PUT requests on a MessageQueue are validated on the following:
When you're sending a message, the Message must be included and be a string of length 1 byte to 256K.
The specified queue must exist. The URL to the queue must have been returned by a POST or GET request on the QueueService endpoint.
This action, if successful, returns Success. If you sent a message to the queue, the action also returns a string representing the ID of the message sent, which you use as the value of the MessageId parameter when performing actions on that message. This action returns an error response if unsuccessful.
| Name | Description | Type | Value |
|---|---|---|---|
Message | A string representing the body of the message to send. The total string length of all the message bodies cannot exceed 256K. Make sure to append the static message ID back to the URL when sending a message. | Required when sending a message | String from 1 byte to 256k |
VisibilityTimeout | The duration, in seconds, that messages are hidden from subsequent GET on MessageQueue requests. See SetVisibilityTimeout for more information. Do not append the static message ID back to the URL when setting the visibility timeout. | Required when setting the visibility timeout | Integer from 0 to 86400 seconds (maximum 24 hours) |
The following examples show how to send messages to the queue and how to set the visibility timeout.
The following example request sends a message to the queue. Note the presence of the back static message ID in the first line.
PUT /QueueURL/back HTTP/1.1 Host: queue.amazonaws.com Authorization: [AWS authentication string] Date: Wed, 05 Apr 2006 21:12:00 GMT Content-Type: text/plain AWS-Version: 2006-04-01 <Message>This is the text of my message.</Message>
See SendMessage (Query) for sample response information.
The following example request sets the visibility timeout for the queue to 60 seconds. Note the absence of the back static message ID in the first line.
PUT /QueueURL?VisibilityTimeout=60 HTTP/1.1 Host: queue.amazonaws.com Authorization: [AWS authentication string] Date: Wed, 05 Apr 2006 21:12:00 GMT Content-Type: text/plain AWS-Version: 2006-04-01
See SetVisibilityTimeout (Query) for sample response information.