/** * @param MailJobInterface|SqsMailJob $mailJob * * @return bool */ public function ack(MailJobInterface $mailJob) { if ($mailJob->isNewRecord()) { throw new InvalidCallException('SqsMailJob cannot be a new object to be acknowledged'); } if ($mailJob->getDeleted()) { $this->getConnection()->getInstance()->deleteMessage(['QueueUrl' => $this->queueUrl, 'ReceiptHandle' => $mailJob->getReceiptHandle()]); return true; } elseif ($mailJob->getVisibilityTimeout() !== null) { $this->getConnection()->getInstance()->changeMessageVisibility(['QueueUrl' => $this->queueUrl, 'ReceiptHandle' => $mailJob->getReceiptHandle(), 'VisibilityTimeout' => $mailJob->getVisibilityTimeout()]); return true; } return false; }