The PeekMessage action returns a preview of the message specified specified. The message is returned regardless of the VisibilityTimeout state on the queue. The visibility state is not modified when PeekMessage is used, therefore this action does not affect which messages are returned by a subsequent ReceiveMessage request. See SetVisibilityTimeout for more information.
A PeekMessage request is validated on the following:
The queue specified must exist. The URL to the queue must have been returned by a CreateQueue or ListQueues request.
MessageId must exist and be a value returned by a ReceiveMessage or SendMessage request.
Returns Success, the message body, and the message ID of the message specified if successful. It returns an error response if unsuccessful.
| Name | Description | Type | Value |
|---|---|---|---|
MessageId | Required. The message ID of the message to return. | String | 17VXQHSGX0SG4ZEPPK7R|0QE42ST4KW7RK9HSY074|0Z4AN912X0H2EP8BV6XJ |
The following example PeekMessage request returns the message associated with the message ID specified.
http://queue.amazonaws.com/A29E9VSPHGOG23/queue1 ?Action=PeekMessage &AWSAccessKeyId=0GS7553JW74RRM612K02 &Version=2006-04-01 &MessageId=17VXQHSGX0SG4ZEPPK7R%7C0QE42ST4KW7RK9HSY074%7C0Z4AN912X0H2EP8BV6XJ &Expires=2007-01-12T12:00:00Z &Signature=CN2SbNq%2B2Vw1W3lbc7wpM5gzDHE=
<PeekMessageResponse>
<Message>
<MessageId>
17VXQHSGX0SG4ZEPPK7R|0QE42ST4KW7RK9HSY074|0Z4AN912X0H2EP8BV6XJ
</MessageId>
<MessageBody>foo</MessageBody>
</Message>
<ResponseStatus>
<StatusCode>Success</StatusCode>
<RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
</ResponseStatus>
</PeekMessageResponse>