deleteMessageBatch method

Future<DeleteMessageBatchResult> deleteMessageBatch({
  1. required List<DeleteMessageBatchRequestEntry> entries,
  2. required String queueUrl,
})

Deletes up to ten messages from the specified queue. This is a batch version of DeleteMessage. The result of the action on each message is reported individually in the response.

May throw BatchEntryIdsNotDistinct. May throw EmptyBatchRequest. May throw InvalidAddress. May throw InvalidBatchEntryId. May throw InvalidSecurity. May throw QueueDoesNotExist. May throw RequestThrottled. May throw TooManyEntriesInBatchRequest. May throw UnsupportedOperation.

Parameter entries : Lists the receipt handles for the messages to be deleted.

Parameter queueUrl : The URL of the Amazon SQS queue from which messages are deleted.

Queue URLs and names are case-sensitive.

Implementation

Future<DeleteMessageBatchResult> deleteMessageBatch({
  required List<DeleteMessageBatchRequestEntry> entries,
  required String queueUrl,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AmazonSQS.DeleteMessageBatch'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Entries': entries,
      'QueueUrl': queueUrl,
    },
  );

  return DeleteMessageBatchResult.fromJson(jsonResponse.body);
}