Reputation: 17181
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?
Upvotes: 3
Views: 1226
Reputation: 23
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.
Upvotes: 0