Skip to content

ChangeMessageVisibility

Source: src/AWS/SQS/ChangeMessageVisibility.ts

Runtime binding for sqs:ChangeMessageVisibility.

Bind this operation to a Queue inside a function runtime to extend or shrink the visibility timeout of an in-flight message — e.g. extend it while a slow job is still processing, or set it to 0 to release the message back to the queue immediately. The binding grants the host function sqs:ChangeMessageVisibility on the queue. Provide the ChangeMessageVisibilityHttp layer on the Function to implement the binding.

Release a Message Back to the Queue

// init (provide SQS.ChangeMessageVisibilityHttp on the Function)
const changeMessageVisibility = yield* SQS.ChangeMessageVisibility(queue);
// runtime: make the message immediately receivable again
yield* changeMessageVisibility({
ReceiptHandle: message.ReceiptHandle!,
VisibilityTimeout: 0,
});

Extend Processing Time for a Slow Job

yield* changeMessageVisibility({
ReceiptHandle: message.ReceiptHandle!,
VisibilityTimeout: 600,
});