Search code examples
amazon-web-servicesaws-sdkamazon-sqsaws-php-sdk

Set AWS SQS visibility timeout for a message when creating the message


I am using the AWS SDK for PHP to push a message into an AWS SQS queue.

I'd like to be able to set the visibility timeout for specific messages to be different than the default. It would make sense to be able to do that, but I can't find a way to do that based on the documentation.

$message = $sqsClient->sendMessage([
   'QueueUrl' => $queueUrl,
   'MessageBody' => json_encode($request),
]);

I can see the ChangeVisibilityTimeout API call, but this requires me to either poll or consume that message then change it which seems counter-intuitive.

Ideally, i'd like to send through the visibility timeout at the same time. Is this possible in some way?


Solution

  • Is this possible in some way?

    Sadly, its not possible.