Skip to content

GetQueueAttributes

Source: src/AWS/SQS/GetQueueAttributes.ts

Runtime binding for sqs:GetQueueAttributes.

Bind this operation to a Queue inside a function runtime to read live queue attributes — e.g. ApproximateNumberOfMessages for queue-depth monitoring or backpressure decisions. The binding grants the host function sqs:GetQueueAttributes on the queue. Provide the GetQueueAttributesHttp layer on the Function to implement the binding.

// init (provide SQS.GetQueueAttributesHttp on the Function)
const getQueueAttributes = yield* SQS.GetQueueAttributes(queue);
// runtime
const result = yield* getQueueAttributes({
AttributeNames: ["ApproximateNumberOfMessages"],
});
const depth = Number(result.Attributes?.ApproximateNumberOfMessages ?? 0);