全部產品
Search
文件中心

Simple Message Queue (formerly MNS):GetQueueAttributes - 擷取隊列屬性

更新時間:Nov 24, 2025

擷取某個已建立隊列的屬性。

介面說明

警告

為最佳化服務效能,輕量訊息佇列即將下線以下欄位的傳回值(後續預設為 0):
- ActiveMessages
- InactiveMessages
- DelayMessages




請通過以下方式擷取替代方案:

  • 使用CloudMonitor OpenAPI 擷取隊列指標,請參考 CloudMonitor OpenAPI 文檔

  • CloudMonitor指標說明文檔,替代欄位對應關係:
    • ActiveMessages → CloudMonitor指標 NumberOfMessagesVisible

    • InactiveMessages → CloudMonitor指標 NumberOfMessagesInvisible

    • DelayMessages → CloudMonitor指標 NumberOfMessagesDelayed

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

mns:GetQueueAttributes

get

*Queue

acs:mns:{#regionId}:{#accountId}:/queues/{#QueueName}

請求參數

名稱

類型

必填

描述

樣本值

QueueName

string

隊列名稱。

demo-queue

Tag

array<object>

資源標籤列表。

object

標籤鍵對應的標籤值。

Key

string

標籤的 key。

tag1

Value

string

標籤值。

test

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求的 ID。

06273500-249F-5863-121D-74D51123****

Code

integer

響應 code。

200

Status

string

響應的狀態。

Success

Message

string

響應資訊。

operation success

Success

boolean

請求是否成功。

true

Data

object

響應資料。

QueueName

string

Queue 的名稱。

demo-queue

CreateTime

integer

Queue 的建立時間。

1250700999

LastModifyTime

integer

修改 Queue 屬性資訊最近時間,從 1970-01-01 00:00:00 到現在的時間。

1250700999

DelaySeconds

integer

發送到該 Queue 的所有訊息的延遲時間,發送到隊列的訊息經過此參數設定的延時時間後,才能被消費,單位為秒。

30

MaximumMessageSize

integer

發送到該 Queue 的訊息體的最大長度,單位為 Byte。

65536

MessageRetentionPeriod

integer

訊息在該 Queue 中最長的存活時間,從發送到該隊列開始經過此參數指定的時間後,不論訊息是否被取出過都將被刪除,單位為秒。

65536

VisibilityTimeout

integer

訊息從該 Queue 中取出後從 Active 狀態變成 Inactive 狀態後的期間。 取值範圍:1~43200,單位為秒。 預設值:30。

60

PollingWaitSeconds

integer

當 Queue 訊息量為空白時,針對該 Queue 的 ReceiveMessage 請求最長的等待時間,單位為秒。

0

ActiveMessages

integer

在該 Queue 中處於 Active 狀態的訊息總數,為近似值。

警告 後續會下線,預設為 0,不推薦使用,請使用CloudMonitor api 擷取指標。

0

InactiveMessages

integer

在該 Queue 中處於 Inactive 狀態的訊息總數,為近似值。

警告 後續會下線,預設為 0,不推薦使用,請使用CloudMonitor api 擷取指標。

0

DelayMessages

integer

在該 Queue 中處於 Delayed 狀態的訊息總數,為近似值。

警告 後續會下線,預設為 0,不推薦使用,請使用CloudMonitor api 擷取指標。

0

LoggingEnabled

boolean

是否開啟日誌管理功能。

  • True:啟用。

  • False:停用。

True

Tags

array<object>

資源標籤列表。

object

標籤鍵對應的標籤值。

TagKey

string

標籤的 key。

tag1

TagValue

string

標籤值。

test

DlqPolicy

object

無效信件佇列策略。

Enabled

boolean

是否開啟死信訊息投遞。

true

DeadLetterTargetQueue

string

死信訊息投遞目標隊列。

deadLetterTargetQueue

MaxReceiveCount

string

訊息最大投遞次數。

3

TenantRateLimitPolicy

object

限流策略

Enabled

boolean

是否啟用限流。取值範圍:

  • true

  • false

true

MaxReceivesPerSecond

integer

每秒最大接收次數

1000

QueueType

string

隊列類型。可取值如下:

  • normal: 普通隊列

  • fifo: FIFO 隊列

normal

樣本

正常返回樣本

JSON格式

{
  "RequestId": "06273500-249F-5863-121D-74D51123****",
  "Code": 200,
  "Status": "Success",
  "Message": "operation success",
  "Success": true,
  "Data": {
    "QueueName": "demo-queue",
    "CreateTime": 1250700999,
    "LastModifyTime": 1250700999,
    "DelaySeconds": 30,
    "MaximumMessageSize": 65536,
    "MessageRetentionPeriod": 65536,
    "VisibilityTimeout": 60,
    "PollingWaitSeconds": 0,
    "ActiveMessages": 0,
    "InactiveMessages": 0,
    "DelayMessages": 0,
    "LoggingEnabled": true,
    "Tags": [
      {
        "TagKey": "tag1",
        "TagValue": "test"
      }
    ],
    "DlqPolicy": {
      "Enabled": true,
      "DeadLetterTargetQueue": "deadLetterTargetQueue",
      "MaxReceiveCount": "3"
    },
    "TenantRateLimitPolicy": {
      "Enabled": true,
      "MaxReceivesPerSecond": 1000
    },
    "QueueType": "normal"
  }
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情