changeMessageVisibilityBatch method

Future<ChangeMessageVisibilityBatchResult> changeMessageVisibilityBatch({
  1. required List<ChangeMessageVisibilityBatchRequestEntry> entries,
  2. required String queueUrl,
})

Changes the visibility timeout of multiple messages. This is a batch version of ChangeMessageVisibility. The result of the action on each message is reported individually in the response. You can send up to 10 ChangeMessageVisibility requests with each ChangeMessageVisibilityBatch action.

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 of the messages for which the visibility timeout must be changed.

Parameter queueUrl : The URL of the Amazon SQS queue whose messages' visibility is changed.

Queue URLs and names are case-sensitive.

Implementation

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

  return ChangeMessageVisibilityBatchResult.fromJson(jsonResponse.body);
}