skip to Main Content

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?

2

Answers


  1. Is this possible in some way?

    Sadly, its not possible.

    Login or Signup to reply.
  2. If your need to delay the message is less than 15 minutes you can use

    DelaySeconds Type: int The length of time, in seconds, for which to
    delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes.
    Messages with a positive DelaySeconds value become available for
    processing after the delay period is finished. If you don’t specify a
    value, the default value for the queue applies.

    Send message. check parameter details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search