updateQmessage method
The Update Message operation updates the visibility timeout of a message. You can also use this operation to update the contents of a message.
popreceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.
message: Required. The message can be up to 64KB in size.
messageId Required. Specifies the valid messageId value returned from an earlier call to the Get Messages or Update Message operation.
visibilitytimeout Required. Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. This API defaults this value to 0. The visibility timeout of a message cannot be set to a value later than the expiry time. A message can be updated until it has been deleted or has expired.
Implementation
Future<void> updateQmessage({
required String qName,
required String messageId,
Duration? vTimeout,
required String message,
required String popReceipt,
}) async {
int time = vTimeout != null ? vTimeout.inSeconds : 0;
String path = 'https://${config[accountName]}.queue.core.windows.net/$qName/messages/$messageId?popreceipt=$popReceipt&visibilitytimeout=$time';
var request = http.Request('PUT', Uri.parse(path));
request.body = '''<QueueMessage>
<MessageText>$message</MessageText>
</QueueMessage> ''';
_sign(request);
var res = await request.send();
if (res.statusCode >= 200 && res.statusCode < 300) {
return;
}
message = await res.stream.bytesToString();
throw AzureStorageException(message, res.statusCode, res.headers);
}