Change the visibility of a message
Give a consumer more time for a received message, or release it to the queue at once.
Replace my-queue with the name of your queue and receipt-handle with the receipt handle of the message's latest receive. The new timeout counts from now, 0 to 43,200 seconds (12 hours); 0 makes the message receivable again at once.
Prerequisites
- Permission for
queue:ChangeMessageVisibilityon the queue. In the console you also needqueue:ReceiveMessageto poll for the message; withoutqueue:ChangeMessageVisibility, Release is unavailable. - In the console, also
queue:GetQueueAttributesto open the queue's page (without it the page is not found). - The message is in flight under that receipt handle: no one has received it since, and its visibility timeout has not ended.
Change the visibility
The console only releases a message:
- Open the queue, then choose Send and receive.
- Under Receive messages, choose Poll for messages.
- On the message, choose Release.
The message leaves the list and can be received again at once.
dcloud queue messages change-visibility my-queue --receipt-handle receipt-handle --visibility-timeout-seconds 300POST /queue/api/queues/my-queue/messages/visibility
{ "receiptHandle": "…", "visibilityTimeoutSeconds": 300 }Up to 10 messages in one request, each with an id of your choosing:
POST /queue/api/queues/my-queue/messages/visibility-batch
{ "entries": [ { "id": "a", "receiptHandle": "…", "visibilityTimeoutSeconds": 0 } ] }The batch answers 200 with successful and failed per id; a failed entry does not fail the
others.
Not available in Terraform. Changing a message's visibility is an action, not configuration.
Result
The message stays hidden for the new timeout, counted from now; with 0 it can be received again at
once. Its receipt handle still deletes it until it is received again. A further change with the same
handle works only while the message is still hidden: once its timeout has ended, or after a change
to 0, the change is refused with MessageNotInflight.
When the change is refused
400with codeMessageNotInflight: "The message is not in flight under this receipt — it was deleted, became visible again, or was received by someone else."400"That is not a receipt handle."