PeekMessage (Query)

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:

Returns Success, the message body, and the message ID of the message specified if successful. It returns an error response if unsuccessful.

NameDescriptionTypeValue
MessageIdRequired. The message ID of the message to return.String17VXQHSGX0SG4ZEPPK7R|0QE42ST4KW7RK9HSY074|0Z4AN912X0H2EP8BV6XJ

The following example PeekMessage request returns the message associated with the message ID specified.

ErrorDescription
MissingParameterMessageId parameter was not present in the request.
MessageNotFoundNo message exists with the MessageId specified.
InvalidURIThe URL for the queue is not valid or was not a URL returned by a CreateQueue or ListQueues request.