peekQmessages method
The Peek Messages operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message.
'qName': Name of the queue is mandatory.
numofmessages: Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. This API also retrieves a single message with this mtod by default
Implementation
Future<List<AzureQMessage>> peekQmessages({
required String qName,
int numofmessages = 1,
}) async {
String path = 'https://${config[accountName]}.queue.core.windows.net/$qName/messages?numofmessages=$numofmessages&peekonly=true';
var request = http.Request('GET', Uri.parse(path));
_sign(request);
var res = await request.send();
var message = await res.stream.bytesToString(); //DEBUG
if (res.statusCode >= 200 && res.statusCode < 300) {
List<AzureQMessage> tabList = _extractQMessages(message);
return tabList;
}
throw AzureStorageException(message, res.statusCode, res.headers);
}