Skip to content

DeleteMessage

Source: src/AWS/SQS/DeleteMessage.ts

Runtime binding for sqs:DeleteMessage.

Bind this operation to a Queue inside a function runtime to delete a message after it has been received and processed. The binding grants the host function sqs:DeleteMessage on the queue. Provide the DeleteMessageHttp layer on the Function to implement the binding.

// init (provide SQS.DeleteMessageHttp on the Function)
const deleteMessage = yield* SQS.DeleteMessage(queue);
// runtime: acknowledge a message received via ReceiveMessage
const result = yield* receiveMessage({ MaxNumberOfMessages: 1 });
const [message] = result.Messages ?? [];
if (message?.ReceiptHandle) {
yield* deleteMessage({ ReceiptHandle: message.ReceiptHandle });
}