QueueClient.peekMessages(Integer maxMessages, Duration timeout, Context context) Method

Definition

Peek messages from the front of the queue up to the maximum number of messages. Peeked messages don't contain the necessary information needed to interact with the message nor will it hide messages from other operations on the queue.

Code Samples

Peek up to the first five messages

{@codesnippet com.azure.storage.queue.queueClient.peekMessages#integer-duration-context}

For more information, see the Azure Docs.

public PagedIterable<PeekedMessageItem> peekMessages(Integer maxMessages, Duration timeout, Context context)

Parameters

maxMessages
java.lang.Integer

Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 messages.

timeout
java.time.Duration

An optional timeout applied to the operation. If a response is not returned before the timeout concludes a RuntimeException will be thrown.

context
Context

Additional context that is passed through the Http pipeline during the service call.

Returns

Up to maxMessages PeekedMessageItem from the queue. Each PeekedMessage contains metadata about the message.

Applies to