Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Message Queue
    • Overview
    • Configuring the AWS CLI
    • Creating a new message queue
    • Sending messages
    • Receiving and deleting messages
    • Deleting a message queue
    • Managing queue labels
    • Monitoring processes in queues
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Public materials
  • FAQ
  1. Step-by-step guides
  2. Receiving and deleting messages

Receiving and deleting messages

Written by
Yandex Cloud
Updated at October 4, 2024

Messages queued in Message Queue are received by consumers, i.e., components of distributed applications. After messages are received and processed, they should be deleted from the queue.

AWS CLI
  1. Install and configure the AWS CLI.

  2. Create a message queue and send a test message to it.

  3. Receive the message you sent earlier:

    aws sqs receive-message \
      --queue-url <queue_URL> \
      --endpoint <endpoint>
    

    Where:

    • --queue-url: URL of the queue to receive the message from.
    • --endpoint: Endpoint set to https://message-queue.api.cloud.yandex.net/.

    Result:

    {
        "Messages": [
            {
                "MessageId": "948de7-9ec8d787-c*******-*",
                "ReceiptHandle": "EAEggbj********",
                "MD5OfBody": "ed076287532e86365e841e92********",
                "Body": "Hello World",
                "Attributes": {
                    "ApproximateFirstReceiveTimestamp": "15459********",
                    "ApproximateReceiveCount": "1",
                    "SentTimestamp": "15459********",
                    "SenderId": "abcdefkbh72is78********"
                }
            }
        ]
    }
    

    Save the ReceiptHandle value: you will need it later.

    Note

    If there are no messages in the queue, the aws sqs receive-message command will end with no text output to the terminal.

  4. To delete a message from a queue, use the receipt ID: the ReceiptHandle parameter value received together with the message.

    Delete the received message from the queue:

    aws sqs delete-message \
      --queue-url <queue_URL> \
      --endpoint <endpoint> \
      --receipt-handle <receipt_ID>
    

    Where:

    • --queue-url: URL of the queue to delete the message from.
    • --endpoint: Endpoint set to https://message-queue.api.cloud.yandex.net/.
    • --receipt-handle: Previously saved message receipt ID (ReceiptHandle).

If the delete command is executed successfully, no text is output to the terminal. To check the deletion of the message:

Management console
  1. In the management console, select the folder where you created the message queue.
  2. In the list of services, select Message Queue.
  3. The current number of enqueued messages is specified in the Messages in queue field.

Was the article helpful?

Previous
Sending messages
Next
Deleting a message queue
© 2025 Direct Cursus Technology L.L.C.