Help us understand the problem. What is going on with this article?

Amazon SQSでキューが削除されない

SQSをメッセージを受信してから、処理を行ってから、そのメッセージを削除するリクエストを送ったのですが、何度リクエストを送っても削除されませんでした。

以下は削除しているPHPのサンプルコードです

### Controller

        $messageList = $sqsService->receiveMessage(
            self::SQS_CONFIG['QueueUrl'],
            self::SQS_CONFIG['MaxNumberOfMessages'],
            self::SQS_CONFIG['AttributeNames']
        );

        if (is_array($messageList) === true) {
            foreach ($messageList as $message) {

                ...

                // SQSのメッセージを削除する
                $sqsService->deleteMessage(self::SQS_CONFIG['QueueUrl'], $message['ReceiptHandle']);
            }
        }

### sqsService

    function deleteMessage($queueUrl, $receiptHandle)
    {
        $result = null;

        try {
            $client = SqsClient::factory(self::CONFIG);
            $result = $client->deleteMessage([
                'QueueUrl' => $queueUrl,
                'ReceiptHandle' => $receiptHandle,
            ]);
        } catch (Exception $e) {
            var_dump($e->getMessage());
        }

        return $result;
    }

ググったところ、以下のstack overflowが見つかりました。
https://stackoverflow.com/questions/10194293/sqs-messages-not-deleting

キューの設定値 defaultVisibilityTimeout0で設定されている場合に削除が行えないようです。
SQSのコンソールから、以下のように値を変更します。

f5d3bd78d48ed9ee6a3d349aa4f89b34.jpg

これで消えるようになりました。
ご参考までに。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away