QueueClient.updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout) Method

Definition

Updates the specific message in the queue with a new message and resets the visibility timeout.

Code Samples

Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

{@codesnippet com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration}

For more information, see the Azure Docs.

public UpdateMessageResult updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout)

Parameters

messageId
java.lang.String

Id of the message to update

popReceipt
java.lang.String

Unique identifier that must match for the message to be updated

messageText
java.lang.String

Updated value for the message

visibilityTimeout
java.time.Duration

The timeout period for how long the message is invisible in the queue in seconds. The timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.

Returns

A UpdateMessageResult that contains the new getPopReceipt() to interact with the message, additionally contains the updated metadata about the message.

Applies to